[Insight-developers] image to vector of images filter
Miller, James V (Research)
millerjv at crd.ge.com
Mon Oct 4 16:45:13 EDT 2004
The closest thing is the BloxImage that caches a link list at each pixel.
I think you want either an Image<Array<> > or an Image<std::vector<> >
You'll probably want to subclass Image, adding a method to set the number
of components the Image should have. I am assuming that every pixel has the
same number of components. Then override the Allocate() method
to make sure the PixelContainer allocates the right number of components
per pixel. You might need to add an overload to the
ImportImagePixelContainer::Reserve() so you can pass in a default value
(ie. the call to the PixelType constructor that allocates the proper
length).
The Allocate() routine in the Image subclass would call
m_PixelContainer->Reserve(num, Array<PixelType>(
m_NumberOfComponents ) );
You may want to look at whether you need to override the FillBuffer() method
in the image class.
You might need to override the SetPixelContainer() method to put in a
check that the PixelContainer being assigned has pixels whose lengths are
consistent with the number of components expected by the Image subclass.
-----Original Message-----
From: gunnar at bwh.harvard.edu [mailto:gunnar at bwh.harvard.edu]
Sent: Monday, October 04, 2004 3:47 PM
To: insight-developers at itk.org
Subject: [Insight-developers] image to vector of images filter
I'm implementing a filter which transforms an image into a vector of
images and need some design advice.
This may sound similar to e.g. a gradient filter but the catch here
is that I need the number of output components to be variable,
depending on a runtime parameter setting.
I suppose that I could try to inherit ImageToImageFilter with the
output type set to Image<std::vector<...>, ...> but I'm unsure whether
it would work and even if it does it seems unnecessarily general (and
thus I assume inefficient) since it allows a varying number of
components from pixel to pixel, which is not interesting.
It seems more natural if I could somehow make a class which takes an
image pointer as input and outputs a variable size vector of image
pointers.
Is there some existing class working like this which I could get some
inspiration from? Any other suggestions how I should implement this?
/Gunnar
_______________________________________________
Insight-developers mailing list
Insight-developers at itk.org
http://www.itk.org/mailman/listinfo/insight-developers
More information about the Insight-developers
mailing list