[Insight-users] ROI by reference (views), eg. ExtractImageFilter
Miller, James V (GE, Research)
millerjv at crd.ge.com
Tue Feb 14 09:59:15 EST 2006
Michael,
As long as you are always operating on a section of the image that is contiguous in memory,
then it is probably possibly to trick the ITK image/filters to do this.
If you want to get into the nuts and bolts, take a look at the ImageSeriesReader/Writer. These
writers can take a 3D image and delegate the image writer to a 2D image writer (ImageFileWriter).
They do this by creating a 2D image and configuring the PixelContainer for the 2D image to
reference the 3D image's underlying pixel buffer. As the SeriesReader/Writer iterates over the
slices, it sets the buffer pointer for the 2D image to be a different position in the 3D image.
You have to be very careful with memory management. You don't want the 2D images to free the
pixel data they are wrapped around. There is a setting on the PixelContainer as to whether the
container manages the memory of not.
So it would be possible to write an ExtractSliceImageFilter for instance, that extracted the
slice into a 2D image without copying the data. That 2D image could be passed to an InPlaceFilter
to perform some operation (the InPlaceFilter will overwrite the data).
This could be fragile. No guarentee that this would keep working as ITK evolves.
Jim
-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Michael Held
Sent: Tuesday, February 14, 2006 5:26 AM
To: insight-users at itk.org
Subject: [Insight-users] ROI by reference (views), eg.
ExtractImageFilter
hi out there,
I am wondering how I can work on 'parts' of image directly? lets say, I want
to do a smoothing for every [x,y] in my [x,y,c,t] image-cube. I could use
itk::ExtractImageFilter, do get all 2D planes, but I don't want to
reassemble the data container afterwards. I would more like to get a "2D
view" out of 4D container (to use 2D algorithms and write the results
directly back into 4D).
is this possible?
thanks!
michael
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list