Hello all,
So I have an image that consists of a sheet of cells which I have segmented in an external python program (SeedWater Segmenter). This is nice as it provides me the functionality to correct any mistakes in the segmentation manually so that at the end I have a very high accuracy segmentation of the cells. The output from SeedWater is a colormap of the different regions where each segmented region is given a different, unique RGB color value. My problem is to now try and read these colorized regions as ROIs in ImageJ (note:please feel free to suggest segmentation plugins for cell sheets already implemented in ImageJ, but I was unable to find one that did a decent job (usually my cells are too small) or allowed for manual corrections). To do this I have two options, each of which presents me with a problem. Option 1: Matlab - I can load the colorized segmentation map into Matlab and readily extract the distinct RGB regions as ROIs. But then how to load the Matlab ROIs into ImageJ? I have read quite a few tutorials on how to load ImageJ ROIs into Matlab, but none on how to go the opposite direction. Option 2: ImageJ directly - It occurred to me that there is probably also a way to assign pixels to an ROI based on their color value, but I have very little experience working with RGB images in ImageJ and even less experience with defining an ROI from a macro. If anyone has worked on something similar and has a suggestion of how I might be able to go about this, I would appreciate the advice. Thanks in advance! |
Dear cnarciso
You could try to use the colorThreshold (Image > Adjust> Color Threshold). It also allows you to collect code to create a macro. I did a quick test on an image with different coloured dots and create the macro code below. Does not guarantee it will work on your samples but might be a starting point: ********start code**************** //run("Duplicate...", "title=Untitled-1"); run("Color Threshold..."); // Color Thresholder 1.49a // Autogenerated macro, single images only! min=newArray(3); max=newArray(3); filter=newArray(3); a=getTitle(); run("HSB Stack"); run("Convert Stack to Images"); selectWindow("Hue"); rename("0"); selectWindow("Saturation"); rename("1"); selectWindow("Brightness"); rename("2"); min[0]=0; max[0]=255; filter[0]="pass"; min[1]=0; max[1]=255; filter[1]="pass"; min[2]=1; max[2]=255; filter[2]="pass"; for (i=0;i<3;i++){ selectWindow(""+i); setThreshold(min[i], max[i]); run("Convert to Mask"); if (filter[i]=="stop") run("Invert"); } imageCalculator("AND create", "0","1"); imageCalculator("AND create", "Result of 0","2"); for (i=0;i<3;i++){ selectWindow(""+i); close(); } selectWindow("Result of 0"); close(); selectWindow("Result of Result of 0"); rename(a); // Colour Thresholding------------- run("Analyze Particles...", " add"); roiManager("Show All with labels"); roiManager("Show All"); *********end code ********************************* The resulting ROIs are stored in the ROI manager Best wishes Kees Dr Ir K.R. Straatman Senior Experimental Officer Advanced Imaging Facility Centre for Core Biotechnology Services University of Leicester http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of cnarciso Sent: 07 May 2014 20:37 To: [hidden email] Subject: ROI in matlab Hello all, So I have an image that consists of a sheet of cells which I have segmented in an external python program (SeedWater Segmenter). This is nice as it provides me the functionality to correct any mistakes in the segmentation manually so that at the end I have a very high accuracy segmentation of the cells. The output from SeedWater is a colormap of the different regions where each segmented region is given a different, unique RGB color value. My problem is to now try and read these colorized regions as ROIs in ImageJ (note:please feel free to suggest segmentation plugins for cell sheets already implemented in ImageJ, but I was unable to find one that did a decent job (usually my cells are too small) or allowed for manual corrections). To do this I have two options, each of which presents me with a problem. Option 1: Matlab - I can load the colorized segmentation map into Matlab and readily extract the distinct RGB regions as ROIs. But then how to load the Matlab ROIs into ImageJ? I have read quite a few tutorials on how to load ImageJ ROIs into Matlab, but none on how to go the opposite direction. Option 2: ImageJ directly - It occurred to me that there is probably also a way to assign pixels to an ROI based on their color value, but I have very little experience working with RGB images in ImageJ and even less experience with defining an ROI from a macro. If anyone has worked on something similar and has a suggestion of how I might be able to go about this, I would appreciate the advice. Thanks in advance! -- View this message in context: http://imagej.1557.x6.nabble.com/ROI-in-matlab-tp5007620.html Sent from the ImageJ mailing list archive at Nabble.com. -- 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 |