Skip to content

Commit

Permalink
2D Registration (rohitrango#10)
Browse files Browse the repository at this point in the history
* Loosening the Version Constraint for the dependencies

* Bug Fix: Issue rohitrango#9

* Bug Fix: rohitrango#9 Image object didn't have the shape attribute for it to check whether its 4D or not

* Update pyproject.toml

Roll back the loosened version constraints proposed.
  • Loading branch information
risan-raja authored Oct 8, 2024
1 parent c8a3297 commit ed3403c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion fireants/io/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def __init__(self, itk_image: sitk.SimpleITK.Image, device: devicetype = 'cuda',
def load_file(cls, image_path:str, *args, **kwargs) -> 'Image':
itk_image = sitk.ReadImage(image_path)
return cls(itk_image, *args, **kwargs)

@property
def shape(self):
return self.array.shape


class BatchedImages:
Expand All @@ -87,7 +91,7 @@ def __init__(self, images: Union[Image, List[Image]]) -> None:
else:
raise ValueError("All images must have the same shape")
self.n_images = len(self.images)
self.interpolate_mode = 'bilinear' if self.images[0] == 2 else 'trilinear'
self.interpolate_mode = 'bilinear' if len(self.images[0].shape) == 4 else 'trilinear'

def __call__(self):
# get batch of images
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ dependencies = [
"SimpleITK==2.2.1",
"nibabel==4.0.2",
"numpy", "scipy", "scikit-image", "matplotlib",
"typing", "tqdm", "pandas==1.3.5", "nibabel==4.0.2",
]
"typing", "tqdm", "pandas==1.3.5"
]

0 comments on commit ed3403c

Please sign in to comment.