Login  Register

Re: get Subimage from ImagePlus

Posted by Wayne Rasband on Oct 21, 2009; 5:42pm
URL: http://imagej.273.s1.nabble.com/get-Subimage-from-ImagePlus-tp3690681p3690682.html

 > Are the cropped-out pixels of the image automatically
 > flushed from memory when setProcessor(null,ip.crop())
 > is performed?

The Java garbage collector should automatically reclaim the memory.

 > Also, can this be run on each slice of a virtual stack
 > as it is called up in an imageProcessor to be
 > displayed?  In other words, can one dynamically crop
 > display of a VirtualStack without the data all being
 > loaded into memory?

You can but the images must be saved to disk as they are cropped. This
is what the new Process>Batch>Virtual Stack command does. Here are the
steps needed to use it to crop a virtual stack:

1. Open a virtual stack
2. Run Process>Batch>Virtual Stack
3. Select an output folder and format
4. Select "Crop" from the "Add Macro Code" menu
5. Edit the macro as needed
6. Click "Test" to verify macro
7. Click "Process" to create the cropped virtual stack

-wayne