[Insight-users] Apply filter only on a specific region of very large image ?

Isaac Abbott isaac.abbott at gmail.com
Thu Jan 28 16:44:13 EST 2010


Here's some more specifics about the problem:
I start with a large 3D image (sometimes RGB, or 16 bit), >2GB.
This image has structures in the foreground that I am trying to segment.
I begin by using several ITK filters to do some pre-processing on the image
(currently the ones listed previously). I write the preprocessed image out
to file.
Now I use a series of executables (I do have source), strung together
(pipeline), that work on segmenting the image.
After each step(exe) the output is written to disk. Output usually includes
an image and a text file.  These files are used as input to the next step.

At the end I want to visualize the original image, and the segmentation
results (from the final text file).
The visual program is not connected to the pipeline. It is a separate
application.

Since I have source - I can modify the pipeline as needed - and plan to.  I
don't see any need to write out a file between each step (unless I need to
see it for debugging).
In the end I see two programs: 1. process 2. visualize.
However, the problem still remains in both cases.

A useful example for me would simply be one that loads part of an image
using itkImageFileReader, applies a filter (maybe binarize), and writes out
the binarized part using itkImageFileWriter..
Say the image is 512x512, but we just load up the first 1/4 of the image
(256x256) to binarize and write out. The output should be 512x512 with 1/4
of it binarized, the rest either blank, or just the original grayscale
values.  I could then use this principle to apply whatever code I wanted to
the image in between the read and write.

Does this make sense?
Isaac

On Thu, Jan 28, 2010 at 4:08 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:

> Hi Isaac,
>
> Thanks for letting us know about the specific filters
> that you are using in the pipeline.
>
> The Median filter is streamable,
>
> While the RecursiveGaussian family of filter is not.
>
> (that is, the Smooth, and Hessian filters based on the
>  RecursiveGaussianImageFilter, are not streamable).
>
>
> The visualization part may not be too much of a problem,
> once the processing of the appropriate chunk has been
> solved.
>
>
> What are you doing with the output of the Hessian and
> the Smooth Gaussian ?
>
> Are you visualizing them directly ?
>
> Note that even though these filters are not strictly
> streamable, they have a support where the influence of
> far away pixels decrease exponentially.  There for you
> could still process the image by chunks and get something
> "very similar" to the actual outcome of filtering the full image
> and then cropping it.
>
> However, the pipeline will not help you in this process,
> you will have to "manually" calculate the region of the
> input image, that comes to be visible in your final rendering,
> and then extract that region out of the input image using
> the RegionOfInterestImageFilter.
>
> Then feed that smaller image into your pipeline.
>
>
>    Please let us know if you find any problems,
>
>
>         Thanks
>
>
>             Luis
>
>
> ---------------------------------------------------------------------------
> On Thu, Jan 28, 2010 at 4:00 PM, Isaac Abbott <isaac.abbott at gmail.com>
> wrote:
> > Currently I am using the MedianImageFilter and the
> > SmoothingRecursiveGaussianImageFilter or
> > HessianRecursiveGaussianImageFilter.
> > We also do some other "filtering" using code that is not in the form of
> an
> > itk filter (doesn't use any ITK yet)
> >
> > This same project requires some visualization of this image - our plan
> was
> > to create a 2D projection and create a sliding box that the is used to
> > define the region that is rendered using VTK.
> > For this task I also need to just grab a portion of the image at one time
> > for creating the projection and for creating the volume.
> >
> > Isaac
> >
> >
> > On Thu, Jan 28, 2010 at 3:48 PM, Luis Ibanez <luis.ibanez at kitware.com>
> > wrote:
> >>
> >> Hi Isaac,
> >>
> >> As you have already noticed, not all filters are
> >> streamable.
> >>
> >> However, for those that are, it should be possible
> >> to process your image by pieces.
> >>
> >> Brad Lowekamp has recently revamped the streaming
> >> pipeline and verified that is possible to pass the entire
> >> Visible Human dataset through an ITK pipeline.
> >>
> >>
> >> What specific ITK filters are you using ?
> >>
> >>
> >> If you are having problems with the pipeline, we should
> >> identify a reproducible minimal example, in case there
> >> is anything that needs to be fixed.
> >>
> >>
> >>    Please let us know,
> >>
> >>
> >>            Thanks
> >>
> >>
> >>
> >>                 Luis
> >>
> >>
> >> -----
> >> PS. I'm copying the ITK users-list, since this
> >> topics will be of interest to many users.
> >>
> >> --------------------------------------------------------------
> >> On Thu, Jan 28, 2010 at 3:43 PM, Isaac Abbott <isaac.abbott at gmail.com>
> >> wrote:
> >> > Luis,
> >> >
> >> > I'm trying to process some very large 3D images.  I cannot load these
> >> > images
> >> > using ImageFileReader because I run out of RAM.
> >> > I would like to apply various filters to only subregions of this
> image,
> >> > and
> >> > write the output to the same output image file.
> >> >
> >> > This means my input and output images might be something like 10,000 x
> >> > 10,000 x 200 voxels, but I only want 1000x1000x100 in memory.
> >> > I'd load up a region, do the processing, then save the result to file,
> >> > and
> >> > iterate, saving the results to the same file each time.
> >> >
> >> > I have been following the discussion about applying filters to ROIs of
> >> > an
> >> > itk::Image.
> >> > I've also seen some discussion about the usage of buffered region vs
> >> > largest
> >> > possible region vs requested region.
> >> > And, I've looked at the StreamingImageFilter - which only seems to
> work
> >> > for
> >> > a limited subset of the filters.
> >> >
> >> > None of these discussions seem to meet my need. According to the
> >> > documentation I should be able to do something with the buffered
> region,
> >> > because this defines only the region of the image that is in memory -
> >> > but I
> >> > haven't seen this work in practice.
> >> >
> >> > Thanks for any help you can give,
> >> > Isaac (Roysam lab, RPI)
> >> >
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100128/07f4b93e/attachment-0001.htm>


More information about the Insight-users mailing list