Hi Dave,
A simple for loop is what you're looking for:
for(N=0;N<roiManager("Count");N++){
roiManager("Select",N);
run("Copy");
newImage("Untitled-"+N, "RGB black", 400, 400, 1);
run("Paste");
saveAs("Jpeg", PATH);
close();
}View this message in context: http://imagej.1557.x6.nabble.----- Original Message -----
From: "DHNguyen" <[hidden email]>
To: [hidden email]
Sent: Tuesday, 23 August, 2016 3:44:14 AM
Subject: help write macro for saving each ROI in ROIManager as separate file
Hi all,
Could someone help me write a macro to save each ROI in an ROIManager as a
separate file?
Here are the variables:
TotalNumROI = this is inputted by the user, which is different for each
image that has many ROIs in it.
N = an integer: 0, 1, 2, etc., up to TotalNumofROI
Here are the core steps:
roiManager("Select", *N*); run("Copy");
newImage("Untitled-*N*", "RGB black", 400, 400, 1);
run("Paste");
saveAs("Jpeg", PATH);
close();
--
I want to be able to open the an image and it's ROI manager, then input the
total number of ROIs into the macro script, and run the macro such that each
ROI is saved as a separate jpeg.
How do I create a loop that changes the integer N by increments of 1 until,
and including, the last ROI is saved as a separate jpeg?
Thanks,
Dave
--com/help-write-macro-for- saving-each-ROI-in-ROIManager- as-separate-file-tp5017095. html
Sent from the ImageJ mailing list archive at Nabble.com.
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
____________________________________________________________ __________
The information in this email is confidential and intended solely for the addressee.
You must not disclose, forward, print or use it without the permission of the sender.
____________________________________________________________ __________
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
If you reply to this email, your message will be added to the discussion below:http://imagej.1557.x6.nabble.com/help-write-macro-for- saving-each-ROI-in-ROIManager- as-separate-file- tp5017095p5017099.html To unsubscribe from help write macro for saving each ROI in ROIManager as separate file, click here.
NAML
Free forum by Nabble | Disable Popup Ads | Edit this page |