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

Geoff Topping g_topping at hotmail.com
Thu Apr 23 17:20:52 EDT 2009


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


More information about the Insight-users mailing list