[Insight-users] ImageMaskSpatialObject with non unsigned char PixelType?

Luke Bloy luke.bloy at gmail.com
Thu Apr 23 17:47:14 EDT 2009


Hi Geoff,

I thought the same thing, if you template ImageMaskSpatialObject over 
the pixeltype and it would still work. However it is pretty simple to 
use an itkCastImageFilter.h to cast your image to unsigned char and this 
way has a smaller memory foot print.

-Luke

Geoff Topping wrote:
> Hi,
>
> I'd like to do some masking of image registration using ImageMaskSpatialObject, but when I try to pass a
>
> itk::Image
>
> to
>
> itk::ImageMaskSpatialObject::SetImage()
>
>
> I get compile errors along the lines of:
>
> error: no matching function for call to `itk::ImageMaskSpatialObject::SetImage(itk::Image<::PixelType, 3u>*)'
> itkImageSpatialObject.txx:281: note: candidates are: void itk::ImageSpatialObject::SetImage(const itk::Image*) [with unsigned int TDimension = 3u, TPixelType = unsigned char]
>
>
> This is apparently because ImageMaskSpatialObject is defined as:
>
> class ImageMaskSpatialObject 
>   : public ImageSpatialObject< TDimension, unsigned char>
>
>
> So I'm wondering, is there a reason ImageMaskSpatialObject can only accept images with PixelType unsigned char?  (Or should it be able to take images with PixelType float?)
>
> Shouldn't it be able to work with any PixelType for which NumericTraits::Zero is valid / defined?
>
> Can I just make my own version of ImageMaskSpatialObject that instantiates its ImageSpatialObject with float instead of unsigned char, or will this cause problems?
>
> Thanks,
> Geoff Topping
>
> _________________________________________________________________
> Internet Explorer 8 helps keep your personal info safe.
> http://go.microsoft.com/?linkid=9655581
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>   


More information about the Insight-users mailing list