How are Stacks coded? What exactly is a Stack? Memory Limitations

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How are Stacks coded? What exactly is a Stack? Memory Limitations

Link-4
Hi, I use imageJ to run a few simple commands: basically, to make a stack and crop it to a Region of Interest. However, I need to start using some applications that require a very large amount of images (TIFF), between 15-20 Thousand frames. The way ImageJ uses memory makes it impossible for me (i think) to crop so many images in a stack (or even to load the stack). I would try to load it virtually but I still need to crop them, so no dice.
What exactly IS an image stack? Is there some other software that can create one? I can crop my images in my video editing software  (final cut pro, or something), but then I need to make the frames a tiff "stack", for my data processing software.

-Thanks
Reply | Threaded
Open this post in threaded view
|

Re: How are Stacks coded? What exactly is a Stack? Memory Limitations

Albert Cardona
If all you need is to crop your images, I recommend this:

- open your image sequence with the Virtual Stack Opener plugin
- write a very small plugin that does this:

imp = WindowManager.getCurrentImage()
roi = imp.getRoi()
stack = imp.getStack()
for i in range(1, stack.getSize()+1):
    ip = stack.getProcessor(i)
    ip.setRoi(roi)
    ip = ip.crop()
    imp = ImagePlus(stack.getLabel(i), ip)
    FileSaver(imp).saveAsTiff("/path/to/new/folder/" + stack.getLabel(i))


The above is written in python, and can be run directly using the Jython
Utilities or even dynamically using the Jython Interpreter. A macro that
does the same could be put together as well in very little time. Or even
a pure java plugin.

Then just reopen the cropped sequence with the Virtual Stack Opener.

A more elaborate plugin would involve rewritting the
setProcessor(ImageProcessor ip) method in the Virtual_Stack_Opener.java
to save the image in a pre-specified directory, so that virtual stacks
would behave like normal stacks, but would have a target directory to
save changes to. Expect performance penalty of course.

As for what is a stack: an array of pixel arrays, the latter of various
type depending upon the ImagePlus.getType() value (byte[], int[],
float[], ...).

Albert
Reply | Threaded
Open this post in threaded view
|

Re: How are Stacks coded? What exactly is a Stack? Memory Limitations

Link-4
Reading the virtual stack opener description made me think that its not usefull for this application, because the stack it generates after the crop command is RAM resident (and mine are too big).

 I use tiff stacks generated with imageJ in some house-built code to analyze the data (tracking movements from frame to frame). So i don't just need to crop my images, I need the resulting images to be an image stack. Is there any other software that creates image stacks like imageJ 's, but without the RAM limitations?
Reply | Threaded
Open this post in threaded view
|

Re: How are Stacks coded? What exactly is a Stack? Memory Limitations

Albert Cardona
> Reading the virtual stack opener description made me think that its not
> usefull for this application, because the stack it generates after the crop
> command is RAM resident (and mine are too big).
>  


In this case, complete the macro/plugin by automatically opening the
cropped images as a virtual stack, and close the original. Call the
macro/plugin "virtual crop" and use it instead of the built-in crop.
Then you no longer have RAM-resident stacks.

If you know java, best way is to hack the Virtual_Stack_Opener.java file
to do the above automatically for you when the built-in "crop" command
is called on the ImagePlus (i.e. specify new dimensions for the stack,
and change the list of file names -one per processor-, or alternatively,
just load the original image and crop it on the fly according to some
built-on cropping Rectangle in your modified VirtualStack class).


>  Is there
> any other software that creates image stacks like imageJ 's, but without the
> RAM limitations?
>  

Not that I know of.

Albert
Reply | Threaded
Open this post in threaded view
|

Re :How are Stacks coded? What exactly is a Stack? Memory Limitations

Damien Haton-Pietrin
In reply to this post by Link-4
Hi, I use ImageJ and QuickTime Pro 7, therefor I Stack frames  (4,000 to
10,000) and / or make stack with large number of them.
An over solution is to programming in MatLab because frames are savable in
text formats it is very powerfull but more expensive (200$ for tools with
image processing). Therefore I prefere working with Quick Time Pro (20$).
Regards

Dr. Damien HATON-PIETRIN
Assistant Hospitalo-Universitaire

Pôle d'Anesthésie Réanimation
Centre Hospitalier Universitaire d'Angers
49933 Angers Cedex France

UPRESS 3143
Laboratoire de Neurophysiologie Physiologie
Faculté de Médecine d'Angers
49000 Angers France
 
Reply | Threaded
Open this post in threaded view
|

Re :How are Stacks coded? What exactly is a Stack? Memory Limitations

Damien Haton-Pietrin
In reply to this post by Link-4
Hi, I use ImageJ and QuickTime Pro 7, therefor I Stack frames  (4,000 to
10,000) and / or make stack with large number of them.
An over solution is to programming in MatLab because frames are savable in
text formats it is very powerfull but more expensive (200$ for tools with
image processing). Therefore I prefere working with Quick Time Pro (20$).
Regards

Dr. Damien HATON-PIETRIN
Assistant Hospitalo-Universitaire

Pôle d'Anesthésie Réanimation
Centre Hospitalier Universitaire d'Angers
49933 Angers Cedex France

UPRESS 3143
Laboratoire de Neurophysiologie Physiologie
Faculté de Médecine d'Angers
49000 Angers France
Reply | Threaded
Open this post in threaded view
|

Re: How are Stacks coded? What exactly is a Stack? Memory Limitations

Jeff Brandenburg
In reply to this post by Link-4
On Feb 26, 2007, at 12:22 PM, Link wrote:

> Reading the virtual stack opener description made me think that its not
> usefull for this application, because the stack it generates after the
> crop
> command is RAM resident (and mine are too big).
>
>  I use tiff stacks generated with imageJ in some house-built code to
> analyze
> the data (tracking movements from frame to frame). So i don't just
> need to
> crop my images, I need the resulting images to be an image stack. Is
> there
> any other software that creates image stacks like imageJ 's, but
> without the
> RAM limitations?

The ImageMagick toolkit supports a wide range of image operations,
including cropping.  Of course, as you observed, so does QuickTime Pro.
  ImageMagick has some facilities for dealing with 3D image formats, but
it's mostly 2D oriented, as I understand it.

Once you've generated your series of cropped TIFF images (by whatever
means), you can still open that image sequence as a virtual stack;
depending on the nature of your house-built code, it may be able to
operate on such a virtual stack, perhaps even efficiently.  
(Frame-by-frame operations are great.  Operations on a local group of
frames may be okay.  Reslicing from the left or right is right out.
:-))
--
        -jeffB (Jeff Brandenburg, Duke Center for In-Vivo Microscopy)