Hi guys,
I'm a PhD student who is pretty new to ImageJ and I would really appreciate it if anyone could help me with this. I'm trying to measure the staining intensity of histologically-stained microglia/macrophages in the penumbral tissue of stroke rats. Basically, I would like my ROI (the penumbral tissue) to be a predetermined 200 um-wide cortical tissue away from the border of the ischemic lesion. I'm having challenges doing this since the area selection tools available cannot precisely depict my irregular ROI. Also, though the freehand tool can be used to outline my irregular ROI, how do I make sure that it's 200 um away from the ischemic core border? Are there any available macros for this or is there any other way? Your help would me highly appreciated. Regards, Abdulhameed Bakreen, University of Eastern Finland -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Michael Cammer,
I actually have DAB-stained sections. These microglia/macrophages are phenotypically different (in cell bodies, processes, surface areas) depending on their activation state and I was hoping to use ImageJ to analyze and compare different phenotypes. Could you please advise me on the acceptable/suitable set measurements? Thanks a lot, Abdulhameed Bakreen -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Abdulhameed Bakreen
Hi guys,
Could someone kindly help me with how I could outline an irregular ROI but with predetermined size? I attached an image to help you visualize it. In the attached image, the enclosed region is the penumbral tissue where I would like to analyze morphology. How do I make this ROI 200 um wide from the border of the scar? -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html ROI.jpg (203K) Download Attachment |
Greetings!
Please have a look at a similar attempt: <https://forum.image.sc/t/outlining-certain-peri-lesion-region/10823/16> It would be helpful if you could provide a typical image without the drawing. This sample image must be either in ".PNG" or ".TIF" format. JPG-compressed images are not suited for scientific analyses. (JPG introduces artifacts that can't be removed! Converting a JPG-compressed image to TIFF- or PNG-format doesn’t make sense.) Regards Herbie ::::::::::::::::::::::::::::::::::::::::::::::::: Am 03.03.20 um 11:45 schrieb Abdulhameed Bakreen: > Hi guys, > > Could someone kindly help me with how I could outline an irregular ROI but with predetermined size? I attached an image to help you visualize it. In the attached image, the enclosed region is the penumbral tissue where I would like to analyze morphology. How do I make this ROI 200 um wide from the border of the scar? > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Abdulhameed Bakreen
Hi Herbie,
Please find attached a ''.png'' format of the sample image. The image was scanned and originally saved in a ''.ndpi'' format, after which I scaled it and saved it as ''.tif'' (too big to send) and then finally as ''.png''. Hope this is OK! P.S. I went through the thread you provided and I tried your macro. I believe that's what I've been looking for. Could you please clarify few things for me, e.g. should the macro for the perilesional area be run before or after highlighting the lesion; should the highlighted lesion be enclosed or is just a straight line across the lesion border enough; how do I make sure that only the perilesional area is being analyzed; and what happens if I have more than 1 perilesional areas for 1 sample image? Please forgive my ignorance here, I'm pretty new to ImageJ. I really appreciate your immense assistance. Best regards, Abdul -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html 3_ROI.png (1M) Download Attachment |
Will shall see Abdul!
"The image was scanned and originally saved in a ''.ndpi'' format, after which I scaled it [...]" Scaling is not a good idea! As you may have seen from the older thread, what is needed, is a 90deg turned image excerpt. Something like the attached image but with the best spatial resolution possible (no scaling). Please make sure what bit-depth the original image has. Is it an 24bit RGB-image (8bit per color)? If yes, you may convert it to 16bit gray-scale. Perhaps even 8bit gray-scale may suffice. I don't have time tonight to dig deeper in the older investigations but I shall do so tomorrow and I shall try with your sample image(s). re: attached older result In any case the cyan line must be drawn first. The macro then draws the yellow line. Please read the whole thread on the Forum. (Actually I've automatically drawn the cyan line but I'm not sure this will work with your sample image [we shall know tomorrow]. The plugin that finds the cyan contour isn't available for free and I'm reluctant to give it away because it isn't easy to operate.) Please stay tuned Herbie ::::::::::::::::::::::::::::::::::::::::::::::::: Am 03.03.20 um 18:56 schrieb Abdulhameed Bakreen: > Hi Herbie, > > Please find attached a ''.png'' format of the sample image. The image was scanned and originally saved in a ''.ndpi'' format, after which I scaled it and saved it as ''.tif'' (too big to send) and then finally as ''.png''. Hope this is OK! > > P.S. I went through the thread you provided and I tried your macro. I believe that's what I've been looking for. Could you please clarify few things for me, e.g. should the macro for the perilesional area be run before or after highlighting the lesion; should the highlighted lesion be enclosed or is just a straight line across the lesion border enough; how do I make sure that only the perilesional area is being analyzed; and what happens if I have more than 1 perilesional areas for 1 sample image? > > Please forgive my ignorance here, I'm pretty new to ImageJ. I really appreciate your immense assistance. > > Best regards, > Abdul > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Abdulhameed Bakreen
Abdul,
attached please find contours that I could find from your sample image. The cyan line was automatically determined and it shows suboptimum behaviour at the right half. Given this line (actually a selection!), either hand drawn or automatic, my macro will find the yellow contour. Please note that the distance between both is not yet calibrated and may not be exactly 200µm. Regards Herbie ::::::::::::::::::::::::::::::::::::::::::::::::: Will shall see Abdul! "The image was scanned and originally saved in a ''.ndpi'' format, after which I scaled it [...]" Scaling is not a good idea! As you may have seen from the older thread, what is needed, is a 90deg turned image excerpt. Something like the attached image but with the best spatial resolution possible (no scaling). Please make sure what bit-depth the original image has. Is it an 24bit RGB-image (8bit per color)? If yes, you may convert it to 16bit gray-scale. Perhaps even 8bit gray-scale may suffice. I don't have time tonight to dig deeper in the older investigations but I shall do so tomorrow and I shall try with your sample image(s). re: attached older result In any case the cyan line must be drawn first. The macro then draws the yellow line. Please read the whole thread on the Forum. (Actually I've automatically drawn the cyan line but I'm not sure this will work with your sample image [we shall know tomorrow]. The plugin that finds the cyan contour isn't available for free and I'm reluctant to give it away because it isn't easy to operate.) Please stay tuned Herbie ::::::::::::::::::::::::::::::::::::::::::::::::: Am 03.03.20 um 18:56 schrieb Abdulhameed Bakreen: > Hi Herbie, > > Please find attached a ''.png'' format of the sample image. The image was scanned and originally saved in a ''.ndpi'' format, after which I scaled it and saved it as ''.tif'' (too big to send) and then finally as ''.png''. Hope this is OK! > > P.S. I went through the thread you provided and I tried your macro. I believe that's what I've been looking for. Could you please clarify few things for me, e.g. should the macro for the perilesional area be run before or after highlighting the lesion; should the highlighted lesion be enclosed or is just a straight line across the lesion border enough; how do I make sure that only the perilesional area is being analyzed; and what happens if I have more than 1 perilesional areas for 1 sample image? > > Please forgive my ignorance here, I'm pretty new to ImageJ. I really appreciate your immense assistance. > > Best regards, > Abdul > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html 3_ROI_excerpt-contours.png (177K) Download Attachment |
In reply to this post by Abdulhameed Bakreen
Dear Abdul,
Below 2 alternative ways to try to extract the area you are interested in. When testing take care that the ROI manager is empty. ------------code 1--------------- run("Colors...", "foreground=white background=black selection=red"); run("Duplicate...", "title=copy"); waitForUser("Draw the border of the ischemic lesion and select \"OK\""); roiManager("add"); run("Line to Area"); run("Enlarge...", "enlarge=200"); run("Clear Outside"); roiManager("Select", 0); --------------------code 2 --------------- run("Colors...", "foreground=white background=black selection=red"); setTool("freeline"); run("Duplicate...", "title=copy"); waitForUser("Draw the border of the ischemic lesion and select \"OK\""); roiManager("add"); Roi.setStrokeWidth(134); run("Straighten..."); getDimensions(width, height, channels, slices, frames); makeRectangle(0, (0.5*height), width, height); run("Crop"); Best wishes Kees Dr Ir K.R. Straatman Senior Experimental Officer Advanced Imaging Facility Centre for Core Biotechnology Services University of Leicester www.le.ac.uk/advanced-imaging-facility -----Original Message----- From: ImageJ Interest Group <[hidden email]> On Behalf Of Abdulhameed Bakreen Sent: 03 March 2020 10:45 To: [hidden email] Subject: Re: Specifying a predetermined ROI Hi guys, Could someone kindly help me with how I could outline an irregular ROI but with predetermined size? I attached an image to help you visualize it. In the attached image, the enclosed region is the penumbral tissue where I would like to analyze morphology. How do I make this ROI 200 um wide from the border of the scar? -- ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7C39bd257b52a34665247708d7bf600ba8%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C1%7C637188291545788100&sdata=FTX6JR%2FeWXjPGxTyDcI6ATtlOB%2FVv%2FFBCJMTn81TOL8%3D&reserved=0 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Abdulhameed Bakreen
Dear Kees,
Thank you for your macros. However, I have not been able to bring them to work as they're requesting I select the ischemic border after running them, even when it's already selected. Have I missed some steps? Anyways, the macro from Herbie has been working very well for me, and I will proceed with it. Once again, I appreciate your effort, Kees. Thanks. Regards, Abdul -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Abdul,
If you have already a selection you can skip the first 3 lines in macro 1 and the first 4 lines in macro 2 and start with roiManager("add"); It is doing the same as in Herbie's macro code but does not require the turn the image. Check if the number of pixels is equal to the 200 µm required. Best wishes Kees -----Original Message----- From: ImageJ Interest Group <[hidden email]> On Behalf Of Abdulhameed Bakreen Sent: 05 March 2020 14:41 To: [hidden email] Subject: Re: Specifying a predetermined ROI Dear Kees, Thank you for your macros. However, I have not been able to bring them to work as they're requesting I select the ischemic border after running them, even when it's already selected. Have I missed some steps? Anyways, the macro from Herbie has been working very well for me, and I will proceed with it. Once again, I appreciate your effort, Kees. Thanks. Regards, Abdul -- ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7C181c6cda524444a5c90008d7c1136d26%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C0%7C637190161506648985&sdata=aiUASVLJV33eZaApZLpSKli7PJSeU%2BYC3CIKgcsbH9M%3D&reserved=0 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Greetings Kees,
my macro also works without the rotation. It is the automatic contour tracing that required it (my macro dates back to May 2018). Because automatic contour tracing isn't presently considered (but could be altered for mostly vertical operation), the rotation is irrelevant. Regards Herbie ::::::::::::::::::::::::::::::::::::::::::::::::::: Am 05.03.20 um 16:18 schrieb Straatman, Kees (Dr.): > Dear Abdul, > > If you have already a selection you can skip the first 3 lines in macro 1 and the first 4 lines in macro 2 and start with roiManager("add"); It is doing the same as in Herbie's macro code but does not require the turn the image. Check if the number of pixels is equal to the 200 µm required. > > Best wishes > > Kees > > -----Original Message----- > From: ImageJ Interest Group <[hidden email]> On Behalf Of Abdulhameed Bakreen > Sent: 05 March 2020 14:41 > To: [hidden email] > Subject: Re: Specifying a predetermined ROI > > Dear Kees, > > Thank you for your macros. However, I have not been able to bring them to work as they're requesting I select the ischemic border after running them, even when it's already selected. Have I missed some steps? > > Anyways, the macro from Herbie has been working very well for me, and I will proceed with it. > > Once again, I appreciate your effort, Kees. Thanks. > > Regards, > Abdul > > -- > ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7C181c6cda524444a5c90008d7c1136d26%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C0%7C637190161506648985&sdata=aiUASVLJV33eZaApZLpSKli7PJSeU%2BYC3CIKgcsbH9M%3D&reserved=0 > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Herbie,
Sorry, my misunderstanding. So with a drawn line the results should be the same. Best wishes Kees -----Original Message----- From: ImageJ Interest Group <[hidden email]> On Behalf Of Herbie Sent: 05 March 2020 15:33 To: [hidden email] Subject: Re: Specifying a predetermined ROI Greetings Kees, my macro also works without the rotation. It is the automatic contour tracing that required it (my macro dates back to May 2018). Because automatic contour tracing isn't presently considered (but could be altered for mostly vertical operation), the rotation is irrelevant. Regards Herbie ::::::::::::::::::::::::::::::::::::::::::::::::::: Am 05.03.20 um 16:18 schrieb Straatman, Kees (Dr.): > Dear Abdul, > > If you have already a selection you can skip the first 3 lines in macro 1 and the first 4 lines in macro 2 and start with roiManager("add"); It is doing the same as in Herbie's macro code but does not require the turn the image. Check if the number of pixels is equal to the 200 µm required. > > Best wishes > > Kees > > -----Original Message----- > From: ImageJ Interest Group <[hidden email]> On Behalf Of > Abdulhameed Bakreen > Sent: 05 March 2020 14:41 > To: [hidden email] > Subject: Re: Specifying a predetermined ROI > > Dear Kees, > > Thank you for your macros. However, I have not been able to bring them to work as they're requesting I select the ischemic border after running them, even when it's already selected. Have I missed some steps? > > Anyways, the macro from Herbie has been working very well for me, and I will proceed with it. > > Once again, I appreciate your effort, Kees. Thanks. > > Regards, > Abdul > > -- > ImageJ mailing list: > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage > j.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7 > C001970a1478b43840ff708d7c11add94%7Caebecd6a31d44b0195ce8274afe853d9%7 > C0%7C0%7C637190193441436433&sdata=1bV4o0sdr4SlTXUVbpW7HVL4w3M236Sz > lWYFHgePgsY%3D&reserved=0 > > -- > ImageJ mailing list: > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage > j.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7 > C001970a1478b43840ff708d7c11add94%7Caebecd6a31d44b0195ce8274afe853d9%7 > C0%7C0%7C637190193441436433&sdata=1bV4o0sdr4SlTXUVbpW7HVL4w3M236Sz > lWYFHgePgsY%3D&reserved=0 > -- ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7C001970a1478b43840ff708d7c11add94%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C0%7C637190193441436433&sdata=1bV4o0sdr4SlTXUVbpW7HVL4w3M236SzlWYFHgePgsY%3D&reserved=0 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Kees,
no problem, your approach is quite similar! (BTW, I had an exchange with the OP yesterday.) "So with a drawn line the results should be the same." Yes, see the attached result. (scale is 68pel=200µm) Here is the macro code for the original image (lesion on the right hand side): // imagej-macro "lesion_handdrawn" (Herbie G., 09. May 2018) // This macro requires a properly set image scale! setBatchMode(true); drawOverlay( "cyan" ); getSelectionCoordinates(xpoints, ypoints); //xpoints = Array.concat(xpoints,xpoints[xpoints.length-1],xpoints[0]); //ypoints = Array.concat(ypoints,-1,-1); xpoints = Array.concat(xpoints,getWidth,getWidth); ypoints = Array.concat(ypoints,ypoints[ypoints.length-1],ypoints[0]); makeSelection("polygon", xpoints, ypoints); run("Enlarge...", "enlarge=200"); drawOverlay( "yellow" ); run("Select None"); setBatchMode(false); exit(); function drawOverlay( color ) { roiManager("Add"); roiManager("Set Color", color); roiManager("Set Line Width", 2); run("Add Selection..."); } // imagej-macro "lesion_handdrawn" (Herbie G., 09. May 2018) The two commented lines apply if the image is turned 90deg counter clockwise. From time to time I'm still trying to improve my automatic edge tracing algorithm but it is really hard to make it easy enough to use. Although it works for me, I judge it rather inconvenient for others. Best Herbie ::::::::::::::::::::::::::::::::::::::::::::::::::: Am 05.03.20 um 19:09 schrieb Straatman, Kees (Dr.): > Hi Herbie, > > Sorry, my misunderstanding. So with a drawn line the results should be the same. > > Best wishes > > Kees > > > -----Original Message----- > From: ImageJ Interest Group <[hidden email]> On Behalf Of Herbie > Sent: 05 March 2020 15:33 > To: [hidden email] > Subject: Re: Specifying a predetermined ROI > > Greetings Kees, > > my macro also works without the rotation. > It is the automatic contour tracing that required it (my macro dates back to May 2018). Because automatic contour tracing isn't presently considered (but could be altered for mostly vertical operation), the rotation is irrelevant. > > Regards > > Herbie > > ::::::::::::::::::::::::::::::::::::::::::::::::::: > Am 05.03.20 um 16:18 schrieb Straatman, Kees (Dr.): >> Dear Abdul, >> >> If you have already a selection you can skip the first 3 lines in macro 1 and the first 4 lines in macro 2 and start with roiManager("add"); It is doing the same as in Herbie's macro code but does not require the turn the image. Check if the number of pixels is equal to the 200 µm required. >> >> Best wishes >> >> Kees >> >> -----Original Message----- >> From: ImageJ Interest Group <[hidden email]> On Behalf Of >> Abdulhameed Bakreen >> Sent: 05 March 2020 14:41 >> To: [hidden email] >> Subject: Re: Specifying a predetermined ROI >> >> Dear Kees, >> >> Thank you for your macros. However, I have not been able to bring them to work as they're requesting I select the ischemic border after running them, even when it's already selected. Have I missed some steps? >> >> Anyways, the macro from Herbie has been working very well for me, and I will proceed with it. >> >> Once again, I appreciate your effort, Kees. Thanks. >> >> Regards, >> Abdul >> >> -- >> ImageJ mailing list: >> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage >> j.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7 >> C001970a1478b43840ff708d7c11add94%7Caebecd6a31d44b0195ce8274afe853d9%7 >> C0%7C0%7C637190193441436433&sdata=1bV4o0sdr4SlTXUVbpW7HVL4w3M236Sz >> lWYFHgePgsY%3D&reserved=0 >> >> -- >> ImageJ mailing list: >> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage >> j.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7 >> C001970a1478b43840ff708d7c11add94%7Caebecd6a31d44b0195ce8274afe853d9%7 >> C0%7C0%7C637190193441436433&sdata=1bV4o0sdr4SlTXUVbpW7HVL4w3M236Sz >> lWYFHgePgsY%3D&reserved=0 >> > > -- > ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Ckrs5%40leicester.ac.uk%7C001970a1478b43840ff708d7c11add94%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C0%7C637190193441436433&sdata=1bV4o0sdr4SlTXUVbpW7HVL4w3M236SzlWYFHgePgsY%3D&reserved=0 > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html 3_ROI-1_handdrawn-notrot-result.png (482K) Download Attachment |
In reply to this post by Abdulhameed Bakreen
Dear Kees and Herbie,
Thank you for your macros. Kees: macro 1 seems to be working now after skipping the first 3 lines; however, after skipping the first 4 lines in macro 2, it is giving the error message: undefined variable in line 2 (Roi.setStrokeWidth(134);). No worries though, as I'm already quarter-way through the analysis using both your macro 1 and Herbie's macro. I guess you could say I'm now spoilt for choices :) I will make sure you're both duly acknowledged wherever this work will be presented. Thanks once again. Regards, Abdul -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |