Once again some advice please. I am trying to select individual ROIs and save them as jpgs. My process is
1) input stack 16 bits images. 2) threshold with black background. 3) apply a mask. 4) extract outlines. 4) analyse with output as drawing of ROIs with object labels shown. The ROImanager is enabled. I have been able to save individual rois as .roi and retrieve them to display on an image. However, I cannot find a way to select a region and save this as a jpg. Any suggestions would be appreciated. Thanks. Douglas Dr Douglas K Benn, BDS, M.Phil., Ph.D., Dipl. Dental Radiology (Royal College of Radiologists, England). Professor Dept of General Dentistry Creighton University Dental School 2500 California Plaza Omaha Nebraska 68178 Tel: (402)280 5025 Fax: (402)280 5094 |
Douglas
You can duplicate the image data inside the ROI, then save as JPG and close. Image>Duplicate, File>Save As>JPG, File>Close. This is the macro code of this sequence of commands: run("Duplicate..."); saveAs("Jpeg"); close(); For a set of ROIs from an ROI manager, you could do it like: n = roiManager("count"); for (i=0; i<n; i++) { roiManager("select", i); run("Duplicate..."); saveAs("Jpeg"); close(); } This could be streamlined to set filenames automatically, and would be faster in batch mode, if you have a lot of images / ROI's to save. http://rsbweb.nih.gov/ij/developer/macro/functions.html Michael Benn, Douglas K. wrote: > Once again some advice please. I am trying to select individual ROIs and save them as jpgs. My process is > > 1) input stack 16 bits images. > 2) threshold with black background. > 3) apply a mask. > 4) extract outlines. > 4) analyse with output as drawing of ROIs with object labels shown. The ROImanager is enabled. > > I have been able to save individual rois as .roi and retrieve them to display on an image. However, I cannot find a way to select a region and save this as a jpg. Any suggestions would be appreciated. > > Thanks. > > Douglas |
Dear Michael,
Thank you for your reply. I did as you suggested and it saved a jpg but the region recorded by selecting the ROI in the manager was a clipped ROI outline as in Drawing 07-1a.jpg . By manually selecting a rectangular region around the ROI which was larger than the ROI I recorded the whole ROI as in Drawing 07-1.jpg It looks like the containing box of the ROI is cutting off the outline by 1x and 1y. I suppose I could generate the box width & height in the Results table and increase that +1x and +1y to ensure my ROI is not cropped. Thanks for your help. Douglas Dr Douglas K Benn, BDS, M.Phil., Ph.D., Dipl. Dental Radiology (Royal College of Radiologists, England). Professor Dept of General Dentistry Creighton University Dental School 2500 California Plaza Omaha Nebraska 68178 Tel: (402)280 5025 Fax: (402)280 5094 -----Original Message----- From: ImageJ Interest Group on behalf of Michael Doube Sent: Sat 4/10/2010 1:46 PM To: [hidden email] Subject: Re: Saving single ROI as jpg Douglas You can duplicate the image data inside the ROI, then save as JPG and close. Image>Duplicate, File>Save As>JPG, File>Close. This is the macro code of this sequence of commands: run("Duplicate..."); saveAs("Jpeg"); close(); For a set of ROIs from an ROI manager, you could do it like: n = roiManager("count"); for (i=0; i<n; i++) { roiManager("select", i); run("Duplicate..."); saveAs("Jpeg"); close(); } This could be streamlined to set filenames automatically, and would be faster in batch mode, if you have a lot of images / ROI's to save. http://rsbweb.nih.gov/ij/developer/macro/functions.html Michael Benn, Douglas K. wrote: > Once again some advice please. I am trying to select individual ROIs and save them as jpgs. My process is > > 1) input stack 16 bits images. > 2) threshold with black background. > 3) apply a mask. > 4) extract outlines. > 4) analyse with output as drawing of ROIs with object labels shown. The ROImanager is enabled. > > I have been able to save individual rois as .roi and retrieve them to display on an image. However, I cannot find a way to select a region and save this as a jpg. Any suggestions would be appreciated. > > Thanks. > > Douglas |
Hi Douglas,
maybe the problem is due to the way ROIs are drawn in Image? The boundary line (usually yellow unless you have changed the color) is inside the roi on the upper and left sides, but outside the roi on the bottom and right sides. It is the same for the line created by Edit>Draw and the Outlines created by Analyze Particles. By the way, this also means that there won't be an outline if the roi touches the edge of the image at the bottom or right side. Michael _________________________________________________________________________ On Sat, April 10, 2010 23:27, Benn, Douglas K. wrote: > Dear Michael, > > Thank you for your reply. > > I did as you suggested and it saved a jpg but the region recorded by > selecting the ROI in the manager was a clipped ROI outline as in Drawing > 07-1a.jpg . By manually selecting a rectangular region around the ROI > which was larger than the ROI I recorded the whole ROI as in Drawing > 07-1.jpg > > It looks like the containing box of the ROI is cutting off the outline by > 1x and 1y. I suppose I could generate the box width & height in the > Results table and increase that +1x and +1y to ensure my ROI is not > cropped. > > Thanks for your help. > > Douglas > > Dr Douglas K Benn, BDS, M.Phil., Ph.D., Dipl. Dental Radiology (Royal > College of Radiologists, England). > Professor > Dept of General Dentistry > Creighton University Dental School > 2500 California Plaza > Omaha > Nebraska 68178 > > Tel: (402)280 5025 > Fax: (402)280 5094 > > > > -----Original Message----- > From: ImageJ Interest Group on behalf of Michael Doube > Sent: Sat 4/10/2010 1:46 PM > To: [hidden email] > Subject: Re: Saving single ROI as jpg > > Douglas > > You can duplicate the image data inside the ROI, then save as JPG and > close. Image>Duplicate, File>Save As>JPG, File>Close. > > This is the macro code of this sequence of commands: > > run("Duplicate..."); > saveAs("Jpeg"); > close(); > > For a set of ROIs from an ROI manager, you could do it like: > > n = roiManager("count"); > for (i=0; i<n; i++) { > roiManager("select", i); > run("Duplicate..."); > saveAs("Jpeg"); > close(); > } > > This could be streamlined to set filenames automatically, and would be > faster in batch mode, if you have a lot of images / ROI's to save. > > http://rsbweb.nih.gov/ij/developer/macro/functions.html > > Michael > > > Benn, Douglas K. wrote: >> Once again some advice please. I am trying to select individual ROIs and >> save them as jpgs. My process is >> >> 1) input stack 16 bits images. >> 2) threshold with black background. >> 3) apply a mask. >> 4) extract outlines. >> 4) analyse with output as drawing of ROIs with object labels shown. The >> ROImanager is enabled. >> >> I have been able to save individual rois as .roi and retrieve them to >> display on an image. However, I cannot find a way to select a region and >> save this as a jpg. Any suggestions would be appreciated. >> >> Thanks. >> >> Douglas > > > |
Free forum by Nabble | Edit this page |