Hello everyone,
I am new at developing macros, and recently I have been working on a macro that quantifies fluorescence intensities in user defined ROI in a cyclic manner. To cut it short, I have 3 ROIs of interest, i want on each image mesure those three ROIs. To do so I have put up FOR boucles for each ROI. So I draw the ROIs on each image after this one as been duplicated (in order to apply filters to ease up the ROI tracing). It works just fine for the first ROI set, but then, when the FOR boucle ends and goes to the next FOR boucle of the next ROI, it seems like the duplication is done only on the last ROI selected. I figured that somehow, it still has the old ROI in mind and duplicates the last selected element so I try to enter commands to unselect that last ROI in order to duplicate the whole image but I am just not able to do it !! A way around it would be to set an ROI with the size of an image but I don’t want it to do it that way, I am sure there is a way to reset the selected ROIs I am not aware of…. Maybe I should put up the code too to make it more clear : //Boucle FOR pour définir la ROI Vasc1 et sauver les mean intens/area vasc1ROInames=newArray(ImageList.length); for(i=0;i<ImageList.length;i++){ ImageFiltering(ImageList[i]); //This is the function to filter the images //Mesure pour ROI Vasc1 output=getROI(ImageList[i],"Vasc1 »); // this is the function to select the ROI Vasc1_intens[i]=output[0]; Vasc1_area[i]=output[1]; vasc1ROInames[i]=ImageList[i]+"_Vasc1"; } Array.print(Vasc1_intens); Array.print(Vasc1_area); Array.print(vasc1ROInames); //I would like here to insert a commands that resets the ROI select to none so that the entire image is selected //Boucle FOR pour définir la ROI Vasc2 et sauver les mean intens/area vasc2ROInames=newArray(ImageList.length); for(i=0;i<ImageList.length;i++){ ImageFiltering(ImageList[i]); //Mesure pour ROI Vasc2 getROI(ImageList[i],"Vasc2"); Vasc2_intens[i]=output[0]; Vasc2_area[i]=output[1]; vasc2ROInames[i]=ImageList[i]+"_Vasc2"; } Array.print(Vasc2_intens); Array.print(Vasc2_area); Array.print(vasc2ROInames); Thanks a lot for your help ! Regards, William Nicolas -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear William,
Maybe you are looking for: roiManager("deselect");(?) Kees -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of William Nicolas Sent: 01 October 2014 09:02 To: [hidden email] Subject: ROI management in macro Hello everyone, I am new at developing macros, and recently I have been working on a macro that quantifies fluorescence intensities in user defined ROI in a cyclic manner. To cut it short, I have 3 ROIs of interest, i want on each image mesure those three ROIs. To do so I have put up FOR boucles for each ROI. So I draw the ROIs on each image after this one as been duplicated (in order to apply filters to ease up the ROI tracing). It works just fine for the first ROI set, but then, when the FOR boucle ends and goes to the next FOR boucle of the next ROI, it seems like the duplication is done only on the last ROI selected. I figured that somehow, it still has the old ROI in mind and duplicates the last selected element so I try to enter commands to unselect that last ROI in order to duplicate the whole image but I am just not able to do it !! A way around it would be to set an ROI with the size of an image but I don't want it to do it that way, I am sure there is a way to reset the selected ROIs I am not aware of.. Maybe I should put up the code too to make it more clear : //Boucle FOR pour définir la ROI Vasc1 et sauver les mean intens/area vasc1ROInames=newArray(ImageList.length); for(i=0;i<ImageList.length;i++){ ImageFiltering(ImageList[i]); //This is the function to filter the images //Mesure pour ROI Vasc1 output=getROI(ImageList[i],"Vasc1 »); // this is the function to select the ROI Vasc1_intens[i]=output[0]; Vasc1_area[i]=output[1]; vasc1ROInames[i]=ImageList[i]+"_Vasc1"; } Array.print(Vasc1_intens); Array.print(Vasc1_area); Array.print(vasc1ROInames); //I would like here to insert a commands that resets the ROI select to none so that the entire image is selected //Boucle FOR pour définir la ROI Vasc2 et sauver les mean intens/area vasc2ROInames=newArray(ImageList.length); for(i=0;i<ImageList.length;i++){ ImageFiltering(ImageList[i]); //Mesure pour ROI Vasc2 getROI(ImageList[i],"Vasc2"); Vasc2_intens[i]=output[0]; Vasc2_area[i]=output[1]; vasc2ROInames[i]=ImageList[i]+"_Vasc2"; } Array.print(Vasc2_intens); Array.print(Vasc2_area); Array.print(vasc2ROInames); Thanks a lot for your help ! Regards, William Nicolas -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |