| 
					
	
	
	
	
				 | 
				
					
	
	 
		Hi group - I am still working out the details, but, I believe I've found
 a bug with ROI management and cropping a stack.
  If I have an ROI on a stack and I crop the image - I get the smallest
 rectangular stack that contains the ROI (as expected).
  But, I noticed that the ROI I had initially used is now replaced by some
 random ROI I had used previously (that is no longer in the ROI manager).
 So - the first time you run the plugin - it looks correct.  But, change
 ROIs and run it again, and you'll see the problem.
 
 
  Oh, excuse the sloppy code, I was debugging it.
 
  roiManager("reset");
 wait(10);
 roiManager("Add");
 wait(10);
 // duplicate image5D
 run("Duplicate");
 id1=getImageID();
 wait(10);
 waitForUser("go 1");
 //get image5D settings
 getDimensions(nw,nh,nch,nsl,nfr);
  //convert to hyperstack
 run("Image5D to Stack");
 id2=getImageID();
 waitForUser("go 2");
 //crop
 selectImage(id2);
 roiManager("select",0);
 wait(10);
 waitForUser("go 3");
 run("Crop");
 // The resulting CROP now has some strange ROI on it - NOT the one used
 to generate it!
 selectImage(id2);
 waitForUser("go 4");
 wait(10);
 run("Clear Outside", "stack");
 wait(10);
 waitForUser("go 5");
 //convert back to image5D
 run("Stack to Image5D", "3rd=ch 4th=z 3rd_dimension_size="+nch+"
 4th_dimension_size="+nsl);
 wait(10);
 roiManager("Reset");
 waitForUser("go 6");
 
	
	
	
	 
				 |