Posted by
Herbie on
URL: http://imagej.273.s1.nabble.com/Specifying-a-predetermined-ROI-tp5023001p5023021.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