Selecting image windows as a menu in ijm.

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

Selecting image windows as a menu in ijm.

Ethan Cohen
I am looking for a way to manually select a stack window (either as a menu, or user input) to an ImageJ Macro.

Anybody know of a way to do this?

selectWindow("Get User Selection"); //select Stack window

.......


Ethan Cohen, Ph.D.
FDA Center for Devices and Radiological Health
Office: Rm 1204 WO62
White Oak Federal Res Ctr.
10903 New Hampshire Ave.
Silver Spring, MD 20993
Reply | Threaded
Open this post in threaded view
|

Re: Selecting image windows as a menu in ijm.

Senseney, Justin (NIH/CIT) [E]
Ethan,

Will selectWindow(getTitle()); work for you?  That returns the window of the current image.  Johannes also provided a nice example of selecting images by id:

https://list.nih.gov/cgi-bin/wa.exe?A2=ind1108&L=IMAGEJ&D=0&1=IMAGEJ&9=A&J=on&d=No+Match%3BMatch%3BMatches&z=4&P=145848

-Justin

BIRSS/ISL/DCB/CIT/NIH
Building 12A/2015


-----Original Message-----
From: Cohen, Ethan D (FDA/CDRH)
Sent: Monday, April 16, 2012 8:59 PM
To: List IMAGEJ
Subject: Selecting image windows as a menu in ijm.

I am looking for a way to manually select a stack window (either as a menu, or user input) to an ImageJ Macro.

Anybody know of a way to do this?

selectWindow("Get User Selection"); //select Stack window

.......


Ethan Cohen, Ph.D.
FDA Center for Devices and Radiological Health
Office: Rm 1204 WO62
White Oak Federal Res Ctr.
10903 New Hampshire Ave.
Silver Spring, MD 20993
Reply | Threaded
Open this post in threaded view
|

Re: Selecting image windows as a menu in ijm.

Michael Schmid
In reply to this post by Ethan Cohen
Hi Ethan,

the easiest would be
  waitForUser("Select the window of the stack that you want to study");

A longer version:
  setBatchMode(true); //unless you have that somewhere
  allStackTitles=newArray(nImages);
  nStacks=0;
  for (i=1; i<=nImages; i++) {
    selectImage(i);
    if (nSlices>1) {
      allStackTitles[nStacks]=getTitle();
      nStacks++;
    }
  }
  if (nStacks <1) exit("No Stack Window Open");
  Dialog.create("Select input");
  Dialog.addChoice("Name", allStackTitles);
  Dialog.show();
  setBatchMode(false); //if you don't continue in BatchMode
  selectWindow(Dialog.getChoice());


Michael
________________________________________________________________
On Apr 17, 2012, at 02:59, Cohen, Ethan D wrote:

> I am looking for a way to manually select a stack window (either as a menu, or user input) to an ImageJ Macro.
>
> Anybody know of a way to do this?
>
> selectWindow("Get User Selection"); //select Stack window
>
> .......
>
>
> Ethan Cohen, Ph.D.
> FDA Center for Devices and Radiological Health
> Office: Rm 1204 WO62
> White Oak Federal Res Ctr.
> 10903 New Hampshire Ave.
> Silver Spring, MD 20993
Reply | Threaded
Open this post in threaded view
|

Re: Selecting image windows as a menu in ijm.

Ethan Cohen
In reply to this post by Senseney, Justin (NIH/CIT) [E]
Justin:

Could you say something like this? (but this does not work).

StackTitle = selectWindow(getTitle());

waitForUser( "Selected Stack: ESC to abort", StackTitle);

I do not want to manually select writte image files.


I want to pick an image stack from those opened in ImageJ.

  list = getList("window.titles"); // But then how to pick in a menu?

Ethan


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Senseney, Justin (NIH/CIT) [E]
Sent: Tuesday, April 17, 2012 8:08 AM
To: [hidden email]
Subject: Re: Selecting image windows as a menu in ijm.

Ethan,

Will selectWindow(getTitle()); work for you?  That returns the window of the current image.  Johannes also provided a nice example of selecting images by id:

https://list.nih.gov/cgi-bin/wa.exe?A2=ind1108&L=IMAGEJ&D=0&1=IMAGEJ&9=A&J=on&d=No+Match%3BMatch%3BMatches&z=4&P=145848

-Justin

BIRSS/ISL/DCB/CIT/NIH
Building 12A/2015


-----Original Message-----
From: Cohen, Ethan D (FDA/CDRH)
Sent: Monday, April 16, 2012 8:59 PM
To: List IMAGEJ
Subject: Selecting image windows as a menu in ijm.

I am looking for a way to manually select a stack window (either as a menu, or user input) to an ImageJ Macro.

Anybody know of a way to do this?

selectWindow("Get User Selection"); //select Stack window

.......


Ethan Cohen, Ph.D.
FDA Center for Devices and Radiological Health
Office: Rm 1204 WO62
White Oak Federal Res Ctr.
10903 New Hampshire Ave.
Silver Spring, MD 20993
Reply | Threaded
Open this post in threaded view
|

Re: Selecting image windows as a menu in ijm.

Senseney, Justin (NIH/CIT) [E]
Hi Ethan,

selectWindow() just activates the image, it's getTitle() that returns the name, try:

StackTitle = getTitle();
selectWindow(StackTitle);

Another useful one: getImageID().

The ImageJ website has a nice list of all available macro functions.  Post here if you have trouble using any of them: http://rsbweb.nih.gov/ij/developer/macro/functions.html

-Justin

-----Original Message-----
From: Cohen, Ethan D (FDA/CDRH)
Sent: Thursday, April 19, 2012 3:36 AM
To: List IMAGEJ
Subject: Re: Selecting image windows as a menu in ijm.

Justin:

Could you say something like this? (but this does not work).

StackTitle = selectWindow(getTitle());

waitForUser( "Selected Stack: ESC to abort", StackTitle);

I do not want to manually select writte image files.


I want to pick an image stack from those opened in ImageJ.

  list = getList("window.titles"); // But then how to pick in a menu?

Ethan


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Senseney, Justin (NIH/CIT) [E]
Sent: Tuesday, April 17, 2012 8:08 AM
To: [hidden email]
Subject: Re: Selecting image windows as a menu in ijm.

Ethan,

Will selectWindow(getTitle()); work for you?  That returns the window of the current image.  Johannes also provided a nice example of selecting images by id:

https://list.nih.gov/cgi-bin/wa.exe?A2=ind1108&L=IMAGEJ&D=0&1=IMAGEJ&9=A&J=on&d=No+Match%3BMatch%3BMatches&z=4&P=145848

-Justin

BIRSS/ISL/DCB/CIT/NIH
Building 12A/2015


-----Original Message-----
From: Cohen, Ethan D (FDA/CDRH)
Sent: Monday, April 16, 2012 8:59 PM
To: List IMAGEJ
Subject: Selecting image windows as a menu in ijm.

I am looking for a way to manually select a stack window (either as a menu, or user input) to an ImageJ Macro.

Anybody know of a way to do this?

selectWindow("Get User Selection"); //select Stack window

.......


Ethan Cohen, Ph.D.
FDA Center for Devices and Radiological Health
Office: Rm 1204 WO62
White Oak Federal Res Ctr.
10903 New Hampshire Ave.
Silver Spring, MD 20993
Reply | Threaded
Open this post in threaded view
|

Re: Selecting image windows as a menu in ijm.

Ethan Cohen
Justin:

Ok, I opened a bunch of images and a stack series in ImageJ.
But your code does not allow me to pick the active (selectWindow).....It just blows right past this "getTitle(); to my waitForUser("pause statement.

I am looking for some sort of a menu like structure to pick the active window and pass it to the program.

  StackTitle = getTitle();
  selectWindow(StackTitle);//select Stack window

  run("Rotate 90 Degrees Right");//  rotate vertically
waitForUser( "Pause","Get cross-sectional profile.\nDraw square ROI. \nMake sure object is \nvertically oriented.");// Enter square ROI


I want something more like pickTitle();

Ethan
-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Senseney, Justin (NIH/CIT) [E]
Sent: Thursday, April 19, 2012 1:52 PM
To: [hidden email]
Subject: Re: Selecting image windows as a menu in ijm.

Hi Ethan,

selectWindow() just activates the image, it's getTitle() that returns the name, try:

StackTitle = getTitle();
selectWindow(StackTitle);

Another useful one: getImageID().

The ImageJ website has a nice list of all available macro functions.  Post here if you have trouble using any of them: http://rsbweb.nih.gov/ij/developer/macro/functions.html

-Justin

-----Original Message-----
From: Cohen, Ethan D (FDA/CDRH)
Sent: Thursday, April 19, 2012 3:36 AM
To: List IMAGEJ
Subject: Re: Selecting image windows as a menu in ijm.

Justin:

Could you say something like this? (but this does not work).

StackTitle = selectWindow(getTitle());

waitForUser( "Selected Stack: ESC to abort", StackTitle);

I do not want to manually select writte image files.


I want to pick an image stack from those opened in ImageJ.

  list = getList("window.titles"); // But then how to pick in a menu?

Ethan


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Senseney, Justin (NIH/CIT) [E]
Sent: Tuesday, April 17, 2012 8:08 AM
To: [hidden email]
Subject: Re: Selecting image windows as a menu in ijm.

Ethan,

Will selectWindow(getTitle()); work for you?  That returns the window of the current image.  Johannes also provided a nice example of selecting images by id:

https://list.nih.gov/cgi-bin/wa.exe?A2=ind1108&L=IMAGEJ&D=0&1=IMAGEJ&9=A&J=on&d=No+Match%3BMatch%3BMatches&z=4&P=145848

-Justin

BIRSS/ISL/DCB/CIT/NIH
Building 12A/2015


-----Original Message-----
From: Cohen, Ethan D (FDA/CDRH)
Sent: Monday, April 16, 2012 8:59 PM
To: List IMAGEJ
Subject: Selecting image windows as a menu in ijm.

I am looking for a way to manually select a stack window (either as a menu, or user input) to an ImageJ Macro.

Anybody know of a way to do this?

selectWindow("Get User Selection"); //select Stack window

.......


Ethan Cohen, Ph.D.
FDA Center for Devices and Radiological Health
Office: Rm 1204 WO62
White Oak Federal Res Ctr.
10903 New Hampshire Ave.
Silver Spring, MD 20993
Reply | Threaded
Open this post in threaded view
|

Re: Selecting image windows as a menu in ijm.

Ethan Cohen
In reply to this post by Michael Schmid
Thanks, Michael.

That was very useful.
I would not of figured that out.

Ethan.

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Michael Schmid
Sent: Tuesday, April 17, 2012 9:39 AM
To: [hidden email]
Subject: Re: Selecting image windows as a menu in ijm.

Hi Ethan,

the easiest would be
  waitForUser("Select the window of the stack that you want to study");

A longer version:
  setBatchMode(true); //unless you have that somewhere
  allStackTitles=newArray(nImages);
  nStacks=0;
  for (i=1; i<=nImages; i++) {
    selectImage(i);
    if (nSlices>1) {
      allStackTitles[nStacks]=getTitle();
      nStacks++;
    }
  }
  if (nStacks <1) exit("No Stack Window Open");
  Dialog.create("Select input");
  Dialog.addChoice("Name", allStackTitles);
  Dialog.show();
  setBatchMode(false); //if you don't continue in BatchMode
  selectWindow(Dialog.getChoice());


Michael
________________________________________________________________
On Apr 17, 2012, at 02:59, Cohen, Ethan D wrote:

> I am looking for a way to manually select a stack window (either as a menu, or user input) to an ImageJ Macro.
>
> Anybody know of a way to do this?
>
> selectWindow("Get User Selection"); //select Stack window
>
> .......
>
>
> Ethan Cohen, Ph.D.
> FDA Center for Devices and Radiological Health
> Office: Rm 1204 WO62
> White Oak Federal Res Ctr.
> 10903 New Hampshire Ave.
> Silver Spring, MD 20993