Skip to content

Commit

Permalink
Fix incorrect call to VectorIndexSelectionCast
Browse files Browse the repository at this point in the history
Added test case for an input image with multiple components (as
opposed to a separate dimension) to cover this code.
  • Loading branch information
blowekamp committed May 18, 2022
1 parent a5cadf2 commit b134a2e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sitkibex/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ def im_read_channel(filename, channel=None): # noqa: C901
if channel_number >= reader.GetNumberOfComponents():
raise Exception("Channel index {} is beyond the number of components {}"
.format(channel_number, reader.GetNumberOfComponents()))
img = sitk.VectorIndexSelectionCastImageFilter(img, channel_number)
img = sitk.VectorIndexSelectionCast(img, channel_number)

return img
Binary file added test/data/vpanel1.nrrd
Binary file not shown.
2 changes: 2 additions & 0 deletions test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def test_cli_reg_help():
['registration', data_files["panel1.nrrd"] + '@JOJO', data_files["panel2.nrrd"] + '@JOJO', 'out.txt'],
['registration', data_files["panel1.nrrd"] + '@4', data_files["panel2.nrrd"] + '@4', 'out.txt'],
['registration', data_files["panel1.nrrd"] + '@Ch5', data_files["panel2.nrrd"] + '@CH5', 'out.txt'],
['registration', data_files["vpanel1.nrrd"] + '@JOJO', data_files["panel2.nrrd"] + '@CH5', 'out.txt'],
['registration', data_files["vpanel1.nrrd"] + '@4', data_files["panel2.nrrd"] + '@CH5', 'out.txt'],
]


Expand Down

0 comments on commit b134a2e

Please sign in to comment.