Macro question

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

Macro question

Johannes Breu
Hello,

I have a general problem with variables writing macros. Just for
illustrating my trouble:

I have a Z-stack and I want to generate one (projection)-image for each
channel. So I wrote a macro (actually  I recorded it):

run ("Z project...", "start=1 stop 6 projection=[Max Intensity]");
run ("Z project...", "start=7 stop 12 projection=[Max Intensity]");


The first command works, the second is obviously attributed to the image
generated by the first command.  So it doesn´t work.

I want to know the following:
1) How can I address the input image throughout the (whole) macro?
2) What is (are) the name(s) of the picture(s) after each procedure?
Probably I would like to something with them later in the macro.

Thanks
Johannes Breu
Reply | Threaded
Open this post in threaded view
|

Re: Macro question

John Alexander-7
Hi Johannes,

In essence, you can use the image ID which is a unique identifier for
each image.

So, in the example you gave ...

id = getImageID();
run ("Z project...", "start=1 stop 6 projection=[Max Intensity]");
selectImage(id); //to restore the selection to the first image
run ("Z project...", "start=7 stop 12 projection=[Max Intensity]");


just to show you how it works - I have the following macro saved as a
template so I can process all opened images easily.

// template for processing all opened images
ids=newArray(nImages);

for (i=0;i<nImages;i++) {
selectImage(i+1);
ids[i]=getImageID();
}

for (imageID=0;imageID<ids.length;imageID++) {
selectImage(ids[imageID]);
//put what you want to do to each image below
//begin

//end
}



~John

Johannes Breu wrote:

> Hello,
>
> I have a general problem with variables writing macros. Just for
> illustrating my trouble:
>
> I have a Z-stack and I want to generate one (projection)-image for each
> channel. So I wrote a macro (actually  I recorded it):
>
> run ("Z project...", "start=1 stop 6 projection=[Max Intensity]");
> run ("Z project...", "start=7 stop 12 projection=[Max Intensity]");
>
>
> The first command works, the second is obviously attributed to the image
> generated by the first command.  So it doesn´t work.
>
> I want to know the following:
> 1) How can I address the input image throughout the (whole) macro?
> 2) What is (are) the name(s) of the picture(s) after each procedure?
> Probably I would like to something with them later in the macro.
>
> Thanks
> Johannes Breu
>

--
John K. Alexander, Ph.D.
Post-Doctoral Fellow
William Green Laboratory
University of Chicago
Dept. Neurobiology, Pharmacology, and Physiology
947 East 58th Street
Abott Hall 402
Chicago, IL 60637
(off) 773-702-9386
(fax) 773-702-3774
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Macro question

Johannes Breu
Thank you very much. This helps but there´s still a problem.

d = getImageID();
run ("Z project...", "start=1 stop 6 projection=[Max Intensity]");
selectImage(id); //to restore the selection to the first image
*\\What´s the place of the picture after the first procedure? *Let´s say
this image A.
run ("Z project...", "start=7 stop 12 projection=[Max Intensity]"); \\image
B is generated
*\\Now, I want to compare image A with image B.*

2008/7/18 John Alexander <[hidden email]>:

> Hi Johannes,
>
> In essence, you can use the image ID which is a unique identifier for
> each image.
>
> So, in the example you gave ...
>
> id = getImageID();
> run ("Z project...", "start=1 stop 6 projection=[Max Intensity]");
> selectImage(id); //to restore the selection to the first image
> run ("Z project...", "start=7 stop 12 projection=[Max Intensity]");
>
>
> just to show you how it works - I have the following macro saved as a
> template so I can process all opened images easily.
>
> // template for processing all opened images
> ids=newArray(nImages);
>
> for (i=0;i<nImages;i++) {
> selectImage(i+1);
> ids[i]=getImageID();
> }
>
> for (imageID=0;imageID<ids.length;imageID++) {
> selectImage(ids[imageID]);
> //put what you want to do to each image below
> //begin
>
> //end

I there a possibility to open all pictures within a file?

>
> }
>
>
>
> ~John
>
> Johannes Breu wrote:
> > Hello,
> >
> > I have a general problem with variables writing macros. Just for
> > illustrating my trouble:
> >
> > I have a Z-stack and I want to generate one (projection)-image for each
> > channel. So I wrote a macro (actually  I recorded it):
> >
> > run ("Z project...", "start=1 stop 6 projection=[Max Intensity]");
> > run ("Z project...", "start=7 stop 12 projection=[Max Intensity]");
> >
> >
> > The first command works, the second is obviously attributed to the image
> > generated by the first command.  So it doesn´t work.
> >
> > I want to know the following:
> > 1) How can I address the input image throughout the (whole) macro?
> > 2) What is (are) the name(s) of the picture(s) after each procedure?
> > Probably I would like to something with them later in the macro.
> >
> > Thanks
> > Johannes Breu
> >
>
> --
> John K. Alexander, Ph.D.
> Post-Doctoral Fellow
> William Green Laboratory
> University of Chicago
> Dept. Neurobiology, Pharmacology, and Physiology
> 947 East 58th Street
> Abott Hall 402
> Chicago, IL 60637
> (off) 773-702-9386
> (fax) 773-702-3774
> [hidden email]
>