Skip to content

Commit

Permalink
Patch release 0.0.1
Browse files Browse the repository at this point in the history
Fixed itk dtype issue
  • Loading branch information
jond01 committed Mar 31, 2020
1 parent 99ae1d5 commit 003616a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This package unifies the io engines of itk, nibabel, and pydicom packages in a s
It includes translation between the metadata conventions, reorientations, affine matrix computation.

# Installation
Download the [whl file](https://drive.google.com/file/d/1JTTrUGeshXd2m--0LK35u5RWY0CvAHVE/view?usp=sharing)
Download the [whl file](https://drive.google.com/open?id=1cr8Tv_zNCSBN5ccWzLxVqmiK4VKueINt)
and install it with:
```
(<env-name>) C:\Users\<username>\Downloads>pip install medio-0.0-py3-none-any.whl
Expand Down
2 changes: 1 addition & 1 deletion medio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from medio.read_save import read_img, save_img
from medio import backends, metadata, utils, medimg

__version__ = '0.0'
__version__ = '0.0.1'

__all__ = ['read_img', 'save_img', '__version__']
11 changes: 9 additions & 2 deletions medio/backends/itk_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ def read_img(input_path, desired_axcodes=None, image_type=image_type):
return image_np, metadata

@staticmethod
def prepare_dcm_image(image_np, dtype=None):
"""Change image_np to correct data type for saving dicom"""
def prepare_dcm_image(image_np):
"""Change image_np to correct data type for saving a single dicom file"""

# if the image is 2d it can be also signed
image_np_sq = np.squeeze(image_np)
if image_np_sq.ndim == 2:
return image_np_sq, image_np_sq.dtype

# if it is 3d, the supported data types are:
dcm_dtypes = [np.uint8, np.uint16]

if image_np.dtype in dcm_dtypes:
Expand Down

0 comments on commit 003616a

Please sign in to comment.