[Insight-users] Importing only a subregion of an image into ITK

Karthik Krishnan karthik.krishnan at kitware.com
Tue Jun 19 12:42:20 EDT 2007


The ImportImageFilter can be used in a mode that does not allocate/copy any
memory. It simply re-uses the same pointer you've set to it by setting the
third param to false.

  /** .... If "LetFilterManageMemory" is true, then this class
   * will free the memory when this object is destroyed. */
  void SetImportPointer(TPixel *ptr, unsigned long num,
                        bool LetFilterManageMemory);

Once that is done, you can also ensure that the filters in you're pipeline,
update only a specific subregion.
  filter->GetOutput()->SetRequestedRegion( subregion );
That will ensure that allocations of dataobjects downstream are of the
needed size alone.

Another thing to watch out for is the ReleaseDataFlag of filters, so as not
to have each filter keeping a copy of the output lying around, but have it
release it to the downstream filter once the downstream filter is done
processing it.


On 6/19/07, Fieselmann, Andreas (ext) <andreas.fieselmann.ext at siemens.com>
wrote:
>
>  Hallo everyone,
>
> I would like to import a 3D image into ITK using the itkImportImageFilter.
> This works fine, but my problem is that the image has a size of about 50
> Mio. voxels and this obvoiusly takes some time to copy.
> What I would like to do now is to import only a subregion of my image into
> ITK (the region which I'm actually interested in). So I have a pointer to
> the memory where the image data is stored in a contiguous block, I have the
> total size of the image and I have the bounding coordinates of the subregion
> (e.g. a cube).
> Is there a way to tell the itkImportImageFilter to import only my
> subregion ? Or is there a different filter that can perform this task ?
> Thank you very much in advance,
> Andreas
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


-- 
karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070619/2eaf2543/attachment.html


More information about the Insight-users mailing list