[Insight-developers] ImageBase->CopyInformation: Number of components per pixel copied

Luis Ibanez luis.ibanez at kitware.com
Sun Sep 30 11:49:23 EDT 2007


Hi Stephen,

That's a good point.

Notice that yet nothing prevents you from changing the number of
components of the recipient image in the GenerateData() method
of your filter, before you fill in the content of the output
image.

Note also, that in practice, the SetNumberOfComponentsPerPixel()
method only performs a real action when it is invoked in an
itkVectorImage.   In any other case, ITK images have compile-time
defined number of components per pixel and the call is simply
ignored.

Are you dealing with a filter that produces an itkVectorImage
as output  ?


      Luis



--------------------------
Stephen R. Aylward wrote:
> Hi,
> 
> The CopyInformation function of ImageBase sets largestPossibleRegion, 
> Spacing, Origin, Directions...all good.
> 
> However, it also sets NumberOfComponentsPerPixel.   Perhaps this is 
> inappropriate since it is not necessary for the images to have the same 
> pixel type for CopyInformation to work.  Perhaps 
> NumberOfComponentsPerPixel is conceptually a pixel-type-specific piece 
> of information.   Admittedly this is arguable, but consider a filter 
> that has a vector image as input and outputs a scalar image...we cannot 
> use the CopyInformation command.
> 
> Of course, the point is perhaps moot given the need for backward 
> compatibility...I cannot think of a backward-compatible solution beyond 
> better documentation.
> 
> Stephen
> 


More information about the Insight-developers mailing list