Login  Register

Re: open ROI.zip

Posted by OBEID Patricia 154904 on Aug 03, 2020; 1:54pm
URL: http://imagej.273.s1.nabble.com/open-ROI-zip-tp5023799p5023811.html

Thanks everyone!
by taking small pieces in each of your proposals, I have come up with something that works.

dir = getDirectory("Choose a Directory ");
dir3 = getDirectory("Choose Destination Directory ");

list = getFileList(dir);
setBatchMode(false);
for (i=0; i<list.length; i++) {
        if (endsWith(list[i], "d1.C01")){
                        path = dir+list[i];
                        open(path);
                                               
                        roiManager("open", replace(path, "d1.C01", "ROI.zip"));

Good afternoon
Patricia

-----Message d'origine-----
De : ImageJ Interest Group <[hidden email]> De la part de Peter Haub
Envoyé : lundi 3 août 2020 14:45
À : [hidden email]
Objet : Re: open ROI.zip

Hi Patricia,

hopefully the following macro gives you a start:
(It loads one zip and all 3 images at a time. Click to load the next set.) (This macro can NOT run in batch mode because in batch no image and no RoiManager is displayed.)

// ****************   macro start ******************* dir = getDirectory("Choose a Directory ");
dir3 = getDirectory("Choose Destination Directory ");

list = getFileList(dir);
//setBatchMode(true);

for (i=0; i<list.length; i++) {

      if (endsWith(list[i], "ROI.zip")){

           roiManager("reset");

           path = dir+list[i];
           //print("Load Roi: " + path);
           roiManager("open", dir+list[i]);

           //ouvrir image des noyaux
           path_d0 = replace(path, "ROI.zip", "d0.C01");
           path_d1 = replace(path, "ROI.zip", "d1.C01");
           path_d2 = replace(path, "ROI.zip", "d2.C01");

           open(path_d0);
           roiManager("Show All");

           open(path_d1);
           roiManager("Show All");

           open(path_d2);
           roiManager("Show All");

           // Do something with the images ....

           waitForUser("Click to open next Set");

           run("Close All");

      }
}
// ****************   macro end *******************

regards
Peter

On 03.08.2020 14:11, OBEID Patricia 154904 wrote:

> Yes, here is
> GRE044662_200731060001_B02f00d0.C01
> GRE044662_200731060001_B02f00d1.C01
> GRE044662_200731060001_B02f00d2.C01
> GRE044662_200731060001_B02f00ROI.zip
>
> GRE044662_200731060001_B02f01d0.C01
> GRE044662_200731060001_B02f01d1.C01
> GRE044662_200731060001_B02f01d2.C01
> GRE044662_200731060001_B02f01ROI.zip
>
> Manually, each file open with imageJ.
> I would like to open the image d1.C01 and the corresponding ROI.zip and that, for all the images d1.C01.
> Patricia
> ____________________________________________________________
>
> Patricia OBEÏD
> Ingénieur de Recherche /Animateur Informatique Biomics Institut de
> Recherche Interdisciplinaire de Grenoble CEA/DRF / IRIG / DS /BGE
> U1038/ Biomics / Bât 4020
> 17 rue des martyrs 38054 Grenoble Cedex 9 Commissariat à l'énergie
> atomique et aux énergies alternatives Email : [hidden email]
> Tél : (+33)4 38 78 47 12         Fax : (+33)4 38 78 59 17
>
> Toute notre actualité sur www.cea.fr et sur
> http://www.cea.fr/drf/big/bge/biomics
>
> Suivez-nous également sur Twitter : @CEA_Recherche et sur
> https://twitter.com/BiomicsLab
>
>
>
> -----Message d'origine-----
> De : ImageJ Interest Group <[hidden email]> De la part de Peter
> Haub Envoyé : lundi 3 août 2020 13:50 À : [hidden email] Objet :
> Re: open ROI.zip
>
> How are the Roi and image files named?
> Can you give some examples.
>
> On 03.08.2020 13:20, OBEID Patricia 154904 wrote:
>> At the moment I don't  expect open the image.
>> I try first to open the ROI.zip and after I will can open the image with the replace function.
>> But at the moment I don't know how to write the first step.
>> I sorry but writing macro is no easy for me.
>> Patricia
>>
>> ____________________________________________________________
>>
>> Patricia OBEÏD
>> Ingénieur de Recherche /Animateur Informatique Biomics Institut de
>> Recherche Interdisciplinaire de Grenoble CEA/DRF / IRIG / DS /BGE
>> U1038/ Biomics / Bât 4020
>> 17 rue des martyrs 38054 Grenoble Cedex 9 Commissariat à l'énergie
>> atomique et aux énergies alternatives Email : [hidden email]
>> Tél : (+33)4 38 78 47 12         Fax : (+33)4 38 78 59 17
>>
>> Toute notre actualité sur www.cea.fr et sur
>> http://www.cea.fr/drf/big/bge/biomics
>>
>> Suivez-nous également sur Twitter : @CEA_Recherche et sur
>> https://twitter.com/BiomicsLab
>>
>>
>>
>> -----Message d'origine-----
>> De : ImageJ Interest Group <[hidden email]> De la part de Peter
>> Haub Envoyé : lundi 3 août 2020 13:14 À : [hidden email] Objet :
>> Re: open ROI.zip
>>
>> ???...
>> If you already know that there is no variable 'path' how can you expect that the combination
>>            pathNuc = replace(path, "ROI.zip", "d1.C01");
>>            open(pathNuc);
>> gives a result?
>>
>> Make sure your path string is correct, e.g. by using the following in your loop:
>>        path = dir+list[i];
>>        print(path);
>>
>> Switch off batch mode by using
>>        setBatchMode(false);
>> to see if this is causing the problem.
>>
>> On 03.08.2020 12:36, OBEID Patricia 154904 wrote:
>>> replace(path, "ROI.zip", "d1.C01");
>>> => There is no variable with the name 'path' in your posted macro!
>>> Yes, it is an error because I tried a lot of things to open the ROI.zip ...
>>> It doesn't work and I cannot continue writing the macro because it
>>> all depends on the opening of the ROI ... :-(
>>>
>>> ( I assume you want to open an image after opening the Rois. Therefore you exchange the "ROI.zip" and "d1.C01".
>>> Is your image file ending with "d1.C01". Is there no extension (e.g.
>>> .tif)? )
>>> That's right. The images were done by a Cellomics machine and the extension is .C01. No problem with that.
>>>
>>> I come back to the starting point, how to open the ROI ?...
>>>
>>> -----Message d'origine-----
>>> De : ImageJ Interest Group <[hidden email]> De la part de Peter
>>> Haub Envoyé : lundi 3 août 2020 12:09 À : [hidden email] Objet :
>>> Re: open ROI.zip
>>>
>>> ".. it does not work .."
>>> What happens?
>>>
>>> replace(path, "ROI.zip", "d1.C01");
>>> => There is no variable with the name 'path' in your posted macro!
>>>
>>> ( I assume you want to open an image after opening the Rois. Therefore you exchange the "ROI.zip" and "d1.C01".
>>> Is your image file ending with "d1.C01". Is there no extension (e.g.
>>> .tif)? )
>>>
>>>
>>> On 03.08.2020 11:51, OBEID Patricia 154904 wrote:
>>>> Thanks Peter,
>>>> The problem is, I have a long list of images and ROIs. I want to open the image and the corresponding ROIManager and therefore make a loop for my treatments but it does not work.
>>>> I started my macro like this:
>>>>
>>>> dir = getDirectory("Choose a Directory ");
>>>> dir3 = getDirectory("Choose Destination Directory ");
>>>>
>>>> list = getFileList(dir);
>>>> setBatchMode(true);
>>>> for (i=0; i<list.length; i++) {
>>>> if (endsWith(list[i], "ROI.zip")){ //A ADAPTER AU NOM DU CHANNEL
>>>> roiManager("open", dir+list[i]);
>>>>
>>>> //ouvrir image des noyaux
>>>> pathNuc = replace(path, "ROI.zip", "d1.C01");
>>>> fileNuc = replace(list[i], "ROI.zip", "d1.C01");
>>>> open(pathNuc);
>>>>
>>>> Can you help me find out what is wrong?
>>>> Thank you
>>>>
>>>>
>>>>
>>>>
>>>> -----Message d'origine-----
>>>> De : ImageJ Interest Group <[hidden email]> De la part de
>>>> Peter Haub Envoyé : lundi 3 août 2020 11:20 À : [hidden email] Objet :
>>>> Re: open ROI.zip
>>>>
>>>> Hi
>>>>
>>>> you can use the Plugins>Macros>Record... function to record the command you are currently using manually.
>>>> This gives at least important hints.
>>>>
>>>> Here is the result for your question:
>>>>
>>>> // (optinal) reset RoiManager
>>>> roiManager("reset");
>>>>
>>>> // Select a roi.zip file vai File Open dialog run("Open...");
>>>>
>>>> // .. alternatively use a path string pointing to the zip file
>>>>
>>>> //roiManager("reset");
>>>> //roiManager("Open", "C:\\PATH_TO_\\RoiSet.zip");
>>>>
>>>> Peter
>>>>
>>>> On 03.08.2020 11:01, OBEID Patricia 154904 wrote:
>>>>> Hello,
>>>>> I would like using a macro to open the ROI.zip (generated previously in a 1st macro) and apply them to images.
>>>>> I write 2 macros to simplify my script writing.
>>>>> But I don't know how to write the command line to open ROI.zip.
>>>>> Could you help me please ?
>>>>> I thank you in advance.
>>>>> Patricia
>>>>> ____________________________________________________________
>>>>> [http://www.cea.fr/var/cea/signatures/cea_logo.jpg]<http://www.cea.
>>>>> f
>>>>> r
>>>>> /
>>>>>> [logo_mail]
>>>>> Patricia OBEÏD
>>>>> Ingénieur de Recherche /Animateur Informatique Biomics Institut de
>>>>> Recherche Interdisciplinaire de Grenoble CEA/DRF / IRIG / DS /BGE
>>>>> U1038/ Biomics / Bât 4020
>>>>> 17 rue des martyrs 38054 Grenoble Cedex 9 Commissariat à l'énergie
>>>>> atomique et aux énergies alternatives Email :
>>>>> [hidden email]<mailto:[hidden email]>
>>>>> Tél : (+33)4 38 78 47 12         Fax : (+33)4 38 78 59 17
>>>>>
>>>>> Toute notre actualité sur www.cea.fr et sur
>>>>> http://www.cea.fr/drf/big/bge/biomics<http://www.cea.fr/>
>>>>>
>>>>> <http://www.cea.fr/>Suivez-nous également sur Twitter :
>>>>> @CEA_Recherche<https://twitter.com/#!/CEA_Recherche> et sur
>>>>> https://twitter.com/BiomicsLab
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>>>
>>>> --
>>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>>
>>>> --
>>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

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