SimpleITK not working with any data type, be it 3D or 2D
I'm using SimpleITK to load in a layered tiff image, its a volumetric image having 30 planes/slices.
After playing around a lot with skimage
and imageio
Ive found out that SimpleITK
is the best way to handle volumetric images but the problem is that none of the functions seem to work for my image.
img = sitk.ReadImage(path)
After reading the image in, I can easily convert it to numpy
and even display it using sitk.Show()
so its loading up properly. but any function I use on it such as:
img_s = sitk.CurvatureFlow(img, 0.125, 5)
# or
sitk.IntensityWindowing(img)
# or
img_m = sitk.ConnectedThreshold(img, (257,419,7))
gives the warning:
sitk::ERROR: Pixel type: vector of 16-bit unsigned integer is not
supported in 3D byclass itk::simple::
I tried casting to to any other datatype as well but I keep getting errors again:
img2 = sitk.Cast(img, sitk.sitkFloat32)
sitk::ERROR: Filter does not support casting from casting vector of
16-bit unsigned integer to 32-bit float
I tried a 2D variation as well of the above:
img_m = sitk.ConnectedThreshold(img2[:,:,7], [(257,419)])
but this time I got the error:
sitk::ERROR: Pixel type: vector of 64-bit float is not supported in 2D
byclass itk::simple::ConnectedThresholdImageFilter
Any idea what may be causing this?
P.S. I have read the question: SimpleITK N4BiasFieldCorrection, not working with any data type and I believe this is not a duplicate as his problem is solved by casting whereas mine does not work even for casting.
Thanks
python python-3.x multidimensional-array itk simpleitk
add a comment |
I'm using SimpleITK to load in a layered tiff image, its a volumetric image having 30 planes/slices.
After playing around a lot with skimage
and imageio
Ive found out that SimpleITK
is the best way to handle volumetric images but the problem is that none of the functions seem to work for my image.
img = sitk.ReadImage(path)
After reading the image in, I can easily convert it to numpy
and even display it using sitk.Show()
so its loading up properly. but any function I use on it such as:
img_s = sitk.CurvatureFlow(img, 0.125, 5)
# or
sitk.IntensityWindowing(img)
# or
img_m = sitk.ConnectedThreshold(img, (257,419,7))
gives the warning:
sitk::ERROR: Pixel type: vector of 16-bit unsigned integer is not
supported in 3D byclass itk::simple::
I tried casting to to any other datatype as well but I keep getting errors again:
img2 = sitk.Cast(img, sitk.sitkFloat32)
sitk::ERROR: Filter does not support casting from casting vector of
16-bit unsigned integer to 32-bit float
I tried a 2D variation as well of the above:
img_m = sitk.ConnectedThreshold(img2[:,:,7], [(257,419)])
but this time I got the error:
sitk::ERROR: Pixel type: vector of 64-bit float is not supported in 2D
byclass itk::simple::ConnectedThresholdImageFilter
Any idea what may be causing this?
P.S. I have read the question: SimpleITK N4BiasFieldCorrection, not working with any data type and I believe this is not a duplicate as his problem is solved by casting whereas mine does not work even for casting.
Thanks
python python-3.x multidimensional-array itk simpleitk
add a comment |
I'm using SimpleITK to load in a layered tiff image, its a volumetric image having 30 planes/slices.
After playing around a lot with skimage
and imageio
Ive found out that SimpleITK
is the best way to handle volumetric images but the problem is that none of the functions seem to work for my image.
img = sitk.ReadImage(path)
After reading the image in, I can easily convert it to numpy
and even display it using sitk.Show()
so its loading up properly. but any function I use on it such as:
img_s = sitk.CurvatureFlow(img, 0.125, 5)
# or
sitk.IntensityWindowing(img)
# or
img_m = sitk.ConnectedThreshold(img, (257,419,7))
gives the warning:
sitk::ERROR: Pixel type: vector of 16-bit unsigned integer is not
supported in 3D byclass itk::simple::
I tried casting to to any other datatype as well but I keep getting errors again:
img2 = sitk.Cast(img, sitk.sitkFloat32)
sitk::ERROR: Filter does not support casting from casting vector of
16-bit unsigned integer to 32-bit float
I tried a 2D variation as well of the above:
img_m = sitk.ConnectedThreshold(img2[:,:,7], [(257,419)])
but this time I got the error:
sitk::ERROR: Pixel type: vector of 64-bit float is not supported in 2D
byclass itk::simple::ConnectedThresholdImageFilter
Any idea what may be causing this?
P.S. I have read the question: SimpleITK N4BiasFieldCorrection, not working with any data type and I believe this is not a duplicate as his problem is solved by casting whereas mine does not work even for casting.
Thanks
python python-3.x multidimensional-array itk simpleitk
I'm using SimpleITK to load in a layered tiff image, its a volumetric image having 30 planes/slices.
After playing around a lot with skimage
and imageio
Ive found out that SimpleITK
is the best way to handle volumetric images but the problem is that none of the functions seem to work for my image.
img = sitk.ReadImage(path)
After reading the image in, I can easily convert it to numpy
and even display it using sitk.Show()
so its loading up properly. but any function I use on it such as:
img_s = sitk.CurvatureFlow(img, 0.125, 5)
# or
sitk.IntensityWindowing(img)
# or
img_m = sitk.ConnectedThreshold(img, (257,419,7))
gives the warning:
sitk::ERROR: Pixel type: vector of 16-bit unsigned integer is not
supported in 3D byclass itk::simple::
I tried casting to to any other datatype as well but I keep getting errors again:
img2 = sitk.Cast(img, sitk.sitkFloat32)
sitk::ERROR: Filter does not support casting from casting vector of
16-bit unsigned integer to 32-bit float
I tried a 2D variation as well of the above:
img_m = sitk.ConnectedThreshold(img2[:,:,7], [(257,419)])
but this time I got the error:
sitk::ERROR: Pixel type: vector of 64-bit float is not supported in 2D
byclass itk::simple::ConnectedThresholdImageFilter
Any idea what may be causing this?
P.S. I have read the question: SimpleITK N4BiasFieldCorrection, not working with any data type and I believe this is not a duplicate as his problem is solved by casting whereas mine does not work even for casting.
Thanks
python python-3.x multidimensional-array itk simpleitk
python python-3.x multidimensional-array itk simpleitk
asked Nov 13 '18 at 16:12
StuckInPhDStuckInPhD
84032144
84032144
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It looks like your image has a vector pixel type. Many filters don't work on vector pixels. You would need to select one particular element of the vector to apply such filters.
You can use the VectorIndexSelectionCastImageFilter or the function VectorIndexSelectionCast to extract a particular channel of the vector out to a scalar image.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285102%2fsimpleitk-not-working-with-any-data-type-be-it-3d-or-2d%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It looks like your image has a vector pixel type. Many filters don't work on vector pixels. You would need to select one particular element of the vector to apply such filters.
You can use the VectorIndexSelectionCastImageFilter or the function VectorIndexSelectionCast to extract a particular channel of the vector out to a scalar image.
add a comment |
It looks like your image has a vector pixel type. Many filters don't work on vector pixels. You would need to select one particular element of the vector to apply such filters.
You can use the VectorIndexSelectionCastImageFilter or the function VectorIndexSelectionCast to extract a particular channel of the vector out to a scalar image.
add a comment |
It looks like your image has a vector pixel type. Many filters don't work on vector pixels. You would need to select one particular element of the vector to apply such filters.
You can use the VectorIndexSelectionCastImageFilter or the function VectorIndexSelectionCast to extract a particular channel of the vector out to a scalar image.
It looks like your image has a vector pixel type. Many filters don't work on vector pixels. You would need to select one particular element of the vector to apply such filters.
You can use the VectorIndexSelectionCastImageFilter or the function VectorIndexSelectionCast to extract a particular channel of the vector out to a scalar image.
answered Nov 13 '18 at 20:13
Dave ChenDave Chen
14416
14416
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285102%2fsimpleitk-not-working-with-any-data-type-be-it-3d-or-2d%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown