Login  Register

Re: get Subimage from ImagePlus

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

 > Hello community
 >
 > I need to cut a subimage from an ImagePlus object. For
 > example I have an ImagePlus object with the size 800X800
 > and I need just a part of this image of the size 400X400.
 >
 > Is there a simple way to do this?

Yes. Here is an example (in JavaScript):

   imp = IJ.openImage("http://rsb.info.nih.gov/ij/images/ct.dcm.zip");
   ip = imp.getProcessor();
   ip.setRoi(233, 0, 400, 400);
   imp.setProcessor(null, ip.crop());
   imp.show();

-wayne