Issues with analyze particules in batch mode (roi became black)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issues with analyze particules in batch mode (roi became black)

fabien
hello, it makes somes days that i try to run an particules analysis with
thoses steps:

//00 - define image directory
//01 - rotates pictures with name finishing with"-07", “-08”, …, “-12”.
//02 - show active picture
//03 - create 3 “roy” .
//04 - Combine Roys
//05 - delete outside of the combined roy
//06 - select “paintbrush” tool
//07 - define the treshold level
//08 - Finalisation and validation by user of treshold settings
//09 - make binary
//10 - Convert picture in 8-bits.
//11 - fill holes
//12 - do an analyze of particules
//13 - saves results
//14 - close everything exept “Results” and “Log”
//15 - delete roys for the next picture

I got several issues:

FOR “//12 - do an analyze of particules” : if i choose Outlines or Masks
results are the same.

my program has worked for 26 pictures and now the second square become all
black whatever the treshold level defined (attached picture).

-the results excel built is in xls and a message appears when i open it, the
message says that the format and the extension of the document is dose’nt
match.

This is the program i built:

        //00 - define image directory
dir = getDirectory(“image”); //define dir for saving names
name = getTitle; //define the name of the picture for savings
index = lastIndexOf(name, “.”); //define index for savings

//01 - rotates pictures with name finishing with"-07", "-08", ..., "-12".
list2=substring(name, 0, (lengthOf(name)-4)); //cut the end of the picture
name
if (endsWith(list2, “-07”)) //if the end of the picture name is “-07”
run("Rotate… “, “angle=180 interpolation=None”); // do a rotation of 180°
if (endsWith(list2, “-08”)) //if the end of the picture name is -08”
run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
if (endsWith(list2, “-09”)) //if the end of the picture name is “-09”
run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
if (endsWith(list2, “-10”)) //if the end of the picture name is “-10”
run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
if (endsWith(list2, “-11”)) //if the end of the picture name is “-11”
run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
if (endsWith(list2, “-12”)) //if the end of the picture name is “-12”
run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°

        //02 - show active picture
setBatchMode(false); //show active picture

//03 - create 3 "roy" .
run(“ROI Manager…”); //lauch of roy manager
makeRectangle(504, 204, 215, 381); // define the first square
roiManager(“add”); // add first square to roi
makeRectangle(262, 204, 224, 362); // define the second square
roiManager(“add”); // add second square to roi
makeRectangle(537, 630, 149, 116); // define the third square
roiManager(“add”); // add third square to roi
roiManager(“select”, newArray(0,1,2)); // select all roys

        //04 - Combine  Roys
roiManager(“Combine”); // combine all roys
roiManager(“add”); // add to roy manager the combined roy
roiManager(“select”, 3); // select the combined roy

        //05 - delete outside of the combined roy
run(“Clear Outside”); // clear outside the combined roy

         //06 - select "paintbrush" tool
setTool( “Paintbrush Tool” ); // select “paintbrush” tool

         //07 - define the treshold level
setThreshold(185, 255); // define the treshold level
run(“Threshold…”); // run threshold

//08 - Finalisation and validation by user  of treshold  settings
waitForUser(“définir le threshold et appuyer sur OK”); //wait user for
clicing to “ok”

        //09 - make binary
run(“Make Binary”); //make binary

        //10 - Convert picture in 8-bits.
run(“8-bit”); //Convert picture in 8-bits.

//11 - fill holes
run(“Fill Holes”); // fill holes

        //12 - do an analyze particules
run(“Analyze Particles…”, “size=50-Infinity show=Outlines display exclude
include summarize”);

//13 - saves results
selectWindow(“Results”); // select “results windows”
getResult (“Area”, 0); // selectionne “Area column”
if (index!=-1) name = substring(name, 0, index); // too smart for me
name = name + “.xls”; // transform name for creating excel file
saveAs(“Results…”, dir+name); //saves results (step 1)
print(dir+name); //saves result (step 2)

//14 - close everything exept "Results" and "Log"
close();
//15 - delete roys for the next picture
roiManager(“Deselect”); //select all roys
roiManager(“Delete”); //delete all roys

I’m not a programmer, i founded parts of code on internet and on this forum
in order to create this program

If someone can help me, thank you A LOT. :slight_smile:

<http://imagej.1557.x6.nabble.com/file/t382132/SO%2BGL-00007-01-05.jpg>



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Issues with analyze particules in batch mode (roi became black)

Jan Eglinger
Hi Fabien,

you already asked this question on the forum:
https://forum.image.sc/t/issues-with-analyze-particules-in-batch-mode-roi-become-black/20129?u=imagejan

Please always disclose when cross-posting on different channels, so
others can follow the discussion and don't waste their time trying to
answer something that has been answered elsewhere already.

Since you already received replies on the forum topic, I suggest we
continue the discussion over there.

Cheers
Jan


On 09.10.2018 13:28, fabien wrote:

> hello, it makes somes days that i try to run an particules analysis with
> thoses steps:
>
> //00 - define image directory
> //01 - rotates pictures with name finishing with"-07", “-08”, …, “-12”.
> //02 - show active picture
> //03 - create 3 “roy” .
> //04 - Combine Roys
> //05 - delete outside of the combined roy
> //06 - select “paintbrush” tool
> //07 - define the treshold level
> //08 - Finalisation and validation by user of treshold settings
> //09 - make binary
> //10 - Convert picture in 8-bits.
> //11 - fill holes
> //12 - do an analyze of particules
> //13 - saves results
> //14 - close everything exept “Results” and “Log”
> //15 - delete roys for the next picture
>
> I got several issues:
>
> FOR “//12 - do an analyze of particules” : if i choose Outlines or Masks
> results are the same.
>
> my program has worked for 26 pictures and now the second square become all
> black whatever the treshold level defined (attached picture).
>
> -the results excel built is in xls and a message appears when i open it, the
> message says that the format and the extension of the document is dose’nt
> match.
>
> This is the program i built:
>
> //00 - define image directory
> dir = getDirectory(“image”); //define dir for saving names
> name = getTitle; //define the name of the picture for savings
> index = lastIndexOf(name, “.”); //define index for savings
>
> //01 - rotates pictures with name finishing with"-07", "-08", ..., "-12".
> list2=substring(name, 0, (lengthOf(name)-4)); //cut the end of the picture
> name
> if (endsWith(list2, “-07”)) //if the end of the picture name is “-07”
> run("Rotate… “, “angle=180 interpolation=None”); // do a rotation of 180°
> if (endsWith(list2, “-08”)) //if the end of the picture name is -08”
> run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
> if (endsWith(list2, “-09”)) //if the end of the picture name is “-09”
> run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
> if (endsWith(list2, “-10”)) //if the end of the picture name is “-10”
> run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
> if (endsWith(list2, “-11”)) //if the end of the picture name is “-11”
> run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
> if (endsWith(list2, “-12”)) //if the end of the picture name is “-12”
> run("Rotate… ", “angle=180 interpolation=None”); // do a rotation of 180°
>
> //02 - show active picture
> setBatchMode(false); //show active picture
>
> //03 - create 3 "roy" .
> run(“ROI Manager…”); //lauch of roy manager
> makeRectangle(504, 204, 215, 381); // define the first square
> roiManager(“add”); // add first square to roi
> makeRectangle(262, 204, 224, 362); // define the second square
> roiManager(“add”); // add second square to roi
> makeRectangle(537, 630, 149, 116); // define the third square
> roiManager(“add”); // add third square to roi
> roiManager(“select”, newArray(0,1,2)); // select all roys
>
> //04 - Combine  Roys
> roiManager(“Combine”); // combine all roys
> roiManager(“add”); // add to roy manager the combined roy
> roiManager(“select”, 3); // select the combined roy
>
> //05 - delete outside of the combined roy
> run(“Clear Outside”); // clear outside the combined roy
>
> //06 - select "paintbrush" tool
> setTool( “Paintbrush Tool” ); // select “paintbrush” tool
>
> //07 - define the treshold level
> setThreshold(185, 255); // define the treshold level
> run(“Threshold…”); // run threshold
>
> //08 - Finalisation and validation by user  of treshold  settings
> waitForUser(“définir le threshold et appuyer sur OK”); //wait user for
> clicing to “ok”
>
> //09 - make binary
> run(“Make Binary”); //make binary
>
> //10 - Convert picture in 8-bits.
> run(“8-bit”); //Convert picture in 8-bits.
>
> //11 - fill holes
> run(“Fill Holes”); // fill holes
>
> //12 - do an analyze particules
> run(“Analyze Particles…”, “size=50-Infinity show=Outlines display exclude
> include summarize”);
>
> //13 - saves results
> selectWindow(“Results”); // select “results windows”
> getResult (“Area”, 0); // selectionne “Area column”
> if (index!=-1) name = substring(name, 0, index); // too smart for me
> name = name + “.xls”; // transform name for creating excel file
> saveAs(“Results…”, dir+name); //saves results (step 1)
> print(dir+name); //saves result (step 2)
>
> //14 - close everything exept "Results" and "Log"
> close();
> //15 - delete roys for the next picture
> roiManager(“Deselect”); //select all roys
> roiManager(“Delete”); //delete all roys
>
> I’m not a programmer, i founded parts of code on internet and on this forum
> in order to create this program
>
> If someone can help me, thank you A LOT. :slight_smile:
>
> <http://imagej.1557.x6.nabble.com/file/t382132/SO%2BGL-00007-01-05.jpg>
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html