[Insight-users] How does the ImportFilter work ?
Agnes Masson-Sibut
agnes.massonsibut at gmail.com
Mon May 3 04:36:29 EDT 2010
Hi Dan,
Thanks for the answer.
Finally, I solved my problem by copying the buffer using the iterator on my
image, instead of using the import filter.
Agnès
2010/5/1 Dan Mueller <dan.muel at gmail.com>
> Hi Agnès,
>
> itkImportImageFilter creates an image around the buffer provided to
> the filter (ie. if you have the buffer in memory, no further memory is
> allocated for the pixels).
>
> If you then use the imported image in a processing pipeline, each
> processing filter will -- typically -- create a new output image (ie.
> allocate a new pixel buffer). Therefore the original imported buffer
> is not changed. You can see this in itkImageSource (from which all
> itkImageToImageFilters derive):
>
> /** The GenerateData method normally allocates the buffers for all of the
> * outputs of a filter. Some filters may want to override this default
> * behavior. For example, a filter may have multiple outputs with
> * varying resolution. Or a filter may want to process data in place by
> * grafting its input to its output. */
> virtual void AllocateOutputs();
>
> This comment alludes to the solution:
> Code/Common/itkInPlaceImageFilter. Running your processing operation
> "in place" means that the output will be stored in the incoming pixel
> buffer. To enable this feature you can call the following on any
> filter which derives from itkInPlaceImageFilter:
> filter->InPlaceOn();
>
> Unfortunately, not all processing operations can run in place (for
> example, operations which change the image resolution, or pixel type).
> Hopefully the processing operation you wish to perform derives from
> itkInPlaceImageFilter...
>
> HTH
>
> Cheers, Dan
>
> On 30 April 2010 17:31, Agnes Masson-Sibut <agnes.massonsibut at gmail.com>
> wrote:
> > Hello everyone,
> >
> > I'm getting an issue when I use an ImportFilter to create an image using
> an
> > existed buffer.
> >
> > In fact, when I do some operations on an image I read from a file, no
> > problem. But when I try to do the same operations on the image created
> from
> > a buffer, it seems to me that the operations are performing on a copy of
> the
> > buffer in the image, and not on the original buffer of the image. So
> that,
> > when I try to save my image, the modifications due to the operations do
> not
> > appear in the saved file.
> >
> > So my question is : Do I have to do something special with the import
> filter
> > so that the object image I get can be filtered by my operations the same
> way
> > the image I get from reading a file ?
> >
> > Thanks a lot.
> >
> > --
> > Agnès Masson-Sibut
> > Étudiante au doctorat
> > Lissi, Université Paris Est Créteil
> > Aesculap SAS, Dpt R&D Software
> > tél : 06-73-60-52-91
>
--
Agnès Masson-Sibut
Étudiante au doctorat
Lissi, Université Paris Est Créteil
Aesculap SAS, Dpt R&D Software
tél : 06-73-60-52-91
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100503/90f91dec/attachment.htm>
More information about the Insight-users
mailing list