Skip to content

Commit

Permalink
Ensure .tif also get read (fixes Example algorithms look for .tiff an…
Browse files Browse the repository at this point in the history
…d not .tif #57) (#66)
  • Loading branch information
chrisvanrun authored Oct 31, 2024
1 parent bb708ea commit 3bfe888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def write_json_file(*, location, content):

def load_image_file_as_array(*, location):
# Use SimpleITK to read a file
input_files = glob(str(location / "*.tiff")) + glob(str(location / "*.mha"))
input_files = glob(str(location / "*.tif")) + glob(str(location / "*.tiff")) + glob(str(location / "*.mha"))
result = SimpleITK.ReadImage(input_files[0])

# Convert it to a Numpy array
Expand All @@ -127,7 +127,7 @@ def load_image_file_as_array(*, location):
def write_array_as_image_file(*, location, array):
location.mkdir(parents=True, exist_ok=True)

# You may need to change the suffix to .tiff to match the expected output
# You may need to change the suffix to .tif to match the expected output
suffix = ".mha"

image = SimpleITK.GetImageFromArray(array)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def write_json_file(*, location, content):

def load_image_file_as_array(*, location):
# Use SimpleITK to read a file
input_files = glob(str(location / "*.tiff")) + glob(str(location / "*.mha"))
input_files = glob(str(location / "*.tif")) + glob(str(location / "*.tiff")) + glob(str(location / "*.mha"))
result = SimpleITK.ReadImage(input_files[0])

# Convert it to a Numpy array
Expand All @@ -125,7 +125,7 @@ def load_image_file_as_array(*, location):
def write_array_as_image_file(*, location, array):
location.mkdir(parents=True, exist_ok=True)

# You may need to change the suffix to .tiff to match the expected output
# You may need to change the suffix to .tif to match the expected output
suffix = ".mha"

image = SimpleITK.GetImageFromArray(array)
Expand Down

0 comments on commit 3bfe888

Please sign in to comment.