[ITK] [ITK-dev] method of concatenating 2D images into a 5D image

Matt McCormick matt.mccormick at kitware.com
Thu Feb 18 13:45:37 EST 2016


Hi Tim,

It is possible to stream-write an image if the output format supports
streamed writing.  MetaImage (.mha) has good support for this. See
this example on how to stream the writer:

  http://www.itk.org/Doxygen/html/Examples_2IO_2VisibleHumanStreamReadWrite_8cxx-example.html#_a7

To generate the image, use an itk::PasteImageFilter.  To keep track of
the higher order indices, itk::RegionOfInterestImageFilter is
suggested instead of itk::ExtractImageFilter.

HTH,
Matt



On Thu, Feb 18, 2016 at 1:06 PM, Tim Jackson <tj.jackson1226 at gmail.com> wrote:
> Hi everyone,
>
> I've recently started working with a very large .nd2 format time lapse
> image, that was taken on a Nikon confocal microscope.  These image sequences
> are 5D (x,y,z,time,channel).  Because these images are so large, trying to
> work on the entire image at once will cause a memory allocation error.
> Therefore I set the reader up in ITK, use a series of ExtractImageFilters to
> break down the giant file into 2D images (I iterate over the time sequence
> in a for loop, obtaining a 2D x, y image for each time frame for each
> channel).
>
> This all works fine, and I'm able to complete the necessary image
> filtering/corrections on these 2D images within the for loop.  My problem
> arises when I'm trying to write the output file.  Ideally, I would like to
> be able to compose all of these images back into one large 5D .nd2 file, but
> if I do this outright, I'm guessing the writer will have a memory allocation
> error.  Is there a way to write the file one frame at a time, adding the
> next frame onto the file as the filtering occurs?  Or is there some other
> way to handle the writing of very large image files to skirt around memory
> allocation problems?  I know I could write each frame as an individual file
> in an image sequence, but then I would have to use a third-party program
> like ImageJ to make them into a stack, merge channels, etc, which is not a
> simple task with the volume of image files I will be analyzing.
>
> Thanks for your help!
> Tim
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-developers
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers


More information about the Community mailing list