Learn scripting with ImageJ

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Learn scripting with ImageJ

Aleksejs Fomins
Dear ImageJ,

I have been using ImageJ for a while, but I never learned how to do
scripting, and now I need it. I know python reasonably well, so I tried
writing a script in python.

My task is to use ImageJ to mark points on an image stack and save to
CSV. Then open that CSV back into ImageJ, move some points around, and
save again. Here is a full description of my problem on stackexchange

https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s

Can you please help me:
1) When I use python as a scripting language inside ImageJ, explain how
I can find the syntax of a given operation. How can I find where a given
class can be imported from?
2) Please help with problem on stack exchange.

Best regards,
Aleksejs Fomins

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

Re: Learn scripting with ImageJ

Fred Damen
Greetings,

Unless there is a requirement to have the csv file as a single source of
external ROI information and involve a script, then look into the ROI Manager
(Analyze -> Tools -> ROI Manager...)

Fred

On Thu, October 4, 2018 12:09 pm, Aleksejs Fomins wrote:

> Dear ImageJ,
>
> I have been using ImageJ for a while, but I never learned how to do
> scripting, and now I need it. I know python reasonably well, so I tried
> writing a script in python.
>
> My task is to use ImageJ to mark points on an image stack and save to
> CSV. Then open that CSV back into ImageJ, move some points around, and
> save again. Here is a full description of my problem on stackexchange
>
> https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s
>
> Can you please help me:
> 1) When I use python as a scripting language inside ImageJ, explain how
> I can find the syntax of a given operation. How can I find where a given
> class can be imported from?
> 2) Please help with problem on stack exchange.
>
> Best regards,
> Aleksejs Fomins
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: Learn scripting with ImageJ

Nick George
Aleksejs,
It can be confusing figuring out how to do certain things with ImageJ from python, especially if you don't have a background in Java. I wrote a quick document demonstrating how to search the javadocs and figure out how to do operations from python https://forum.image.sc/t/expanding-jython-scripting-with-the-java-api-on-the-wiki/11768, which may be useful for point 1 and other problems you want to address in the future.
Nick


On 10/4/18 12:16 PM, Fred Damen wrote:

> Greetings,
>
> Unless there is a requirement to have the csv file as a single source of
> external ROI information and involve a script, then look into the ROI Manager
> (Analyze -> Tools -> ROI Manager...)
>
> Fred
>
> On Thu, October 4, 2018 12:09 pm, Aleksejs Fomins wrote:
>> Dear ImageJ,
>>
>> I have been using ImageJ for a while, but I never learned how to do
>> scripting, and now I need it. I know python reasonably well, so I tried
>> writing a script in python.
>>
>> My task is to use ImageJ to mark points on an image stack and save to
>> CSV. Then open that CSV back into ImageJ, move some points around, and
>> save again. Here is a full description of my problem on stackexchange
>>
>> https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s
>>
>> Can you please help me:
>> 1) When I use python as a scripting language inside ImageJ, explain how
>> I can find the syntax of a given operation. How can I find where a given
>> class can be imported from?
>> 2) Please help with problem on stack exchange.
>>
>> Best regards,
>> Aleksejs Fomins
>>
>> --
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Learn scripting with ImageJ

Curtis Rueden
In reply to this post by Fred Damen
Hi Aleksejs,

In addition to others' comments: have you read the Jython Scripting page on
the ImageJ wiki?
  https://imagej.net/Jython_Scripting

There is a lot of information there to teach scripting in Jython.

Regards
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? https://forum.image.sc/



On Thu, Oct 4, 2018 at 4:23 PM Nicholas George <[hidden email]>
wrote:

> Aleksejs,
> It can be confusing figuring out how to do certain things with ImageJ from
> python, especially if you don't have a background in Java. I wrote a quick
> document demonstrating how to search the javadocs and figure out how to do
> operations from python
> https://forum.image.sc/t/expanding-jython-scripting-with-the-java-api-on-the-wiki/11768,
> which may be useful for point 1 and other problems you want to address in
> the future.
> Nick
>
>
> On 10/4/18 12:16 PM, Fred Damen wrote:
> > Greetings,
> >
> > Unless there is a requirement to have the csv file as a single source of
> > external ROI information and involve a script, then look into the ROI
> Manager
> > (Analyze -> Tools -> ROI Manager...)
> >
> > Fred
> >
> > On Thu, October 4, 2018 12:09 pm, Aleksejs Fomins wrote:
> >> Dear ImageJ,
> >>
> >> I have been using ImageJ for a while, but I never learned how to do
> >> scripting, and now I need it. I know python reasonably well, so I tried
> >> writing a script in python.
> >>
> >> My task is to use ImageJ to mark points on an image stack and save to
> >> CSV. Then open that CSV back into ImageJ, move some points around, and
> >> save again. Here is a full description of my problem on stackexchange
> >>
> >>
> https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s
> >>
> >> Can you please help me:
> >> 1) When I use python as a scripting language inside ImageJ, explain how
> >> I can find the syntax of a given operation. How can I find where a given
> >> class can be imported from?
> >> 2) Please help with problem on stack exchange.
> >>
> >> Best regards,
> >> Aleksejs Fomins
> >>
> >> --
> >> 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
Reply | Threaded
Open this post in threaded view
|

Re: Learn scripting with ImageJ

John Minter
In reply to this post by Aleksejs Fomins
Let me help with this part.
1. Check out the java docs from here:
https://javadoc.scijava.org/
I assume you are using ImageJ1. If so open that and you can see the
functions that are exported from java and how to call them.

You can see some example Jython scripts here:
http://wiki.cmci.info/documents/120206pyip_cooking/python_imagej_cookbook

Note: you have to specifically import the classes before you use them. Note
the example:
from ij import IJ
imp = IJ.getImage()

In this case the getImage() function returns an ImagePlus
<https://javadoc.scijava.org/ImageJ1/ij/ImagePlus.html> which is a
reference to the active image.

You will need to spend some time trying the examples in the ScriptEditor (I
really like the editor in the Fiji distribution of ImageJ. You will have to
specify the language as python... There is really no substitute for working
through examples. One advantage is that you can create libraries of python
functions in a "Lib" folder in the jars directory and reuse them. This made
my life a lot easier...

Hope this helps you to get started. Once you get a library of functions,
you won't find yourself repeatedly writing the same code...

Hope this helps...

Best wishes,
John Minter


On Thu, Oct 4, 2018 at 1:42 PM Aleksejs Fomins <[hidden email]>
wrote:
...

Can you please help me:
> 1) When I use python as a scripting language inside ImageJ, explain how
> I can find the syntax of a given operation. How can I find where a given
> class can be imported from?
>

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

Re: Learn scripting with ImageJ

Aleksejs Fomins
Dear all,

Thanks a lot for all your replies. They are very much appreciated. If
possible, I have follow-up questions.

1) I have looked at the ROI Manager. It does exactly what I want in
terms of loading and saving. Now I need to be able to edit the files
externally. Is there a documentation on the structure of these files?

2) I have looked at the java docs as suggested. In the below index

https://javadoc.scijava.org/ImageJ1/index-all.html

I was able to find that "makePoint(int, int) - Static method in class
ij.IJ". However, I was not able to find any method called
"makeSelection", although it is clearly possible to use it in ImageJ, at
least in the ".ijm" scripts. So I tried using "makePoint" in my script,
but only the last point is ever visible, all the previously placed
points disappear. Moreover, that point is the same for all slices. I
wanted it to be unique for each slice. Can you please suggest, what is
the command that can place unique numbered points like it is done by the
ROI manager?

3) I like the FIJI editor, but I can't figure out how to increase its
Font Size. I have a huge monitor, and a lot of things are really small.
I mean, the Font of the code itself is easy to change, but how to change
the font of the code output, or the font size of the tabs like File |
Edit | Language?

Thanks,
Aleksejs Fomins

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

Re: Learn scripting with ImageJ

John Minter
Open the Fiji Script editor. Select the Edit menu. Look in the 4th block of
commands in that menu and you will find a pull-right option for Font Sizes.
On my system, the list goes up to 42 points and there is an "other" option.

Hope this helps.

John

On Fri, Oct 5, 2018 at 9:41 AM Aleksejs Fomins <[hidden email]>
wrote:

> 3) I like the FIJI editor, but I can't figure out how to increase its
> Font Size. I have a huge monitor, and a lot of things are really small.
> I mean, the Font of the code itself is easy to change, but how to change
> the font of the code output, or the font size of the tabs like File |
> Edit | Language?
>
>

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

Re: Learn scripting with ImageJ

Fred Damen
In ImageJ(1) for the menus what you are looking for is:
Edit->Options...->Appearance...=>Menu Font Size

On Windows, if I change this from the default to 16, both the menu button and
menu items increase in font size. If I increase to 18 and above the menu
button font size decreases and the menu item size increases.

On Linux/Windows/Mac, every time I open the code editor I change to a fixed
width font, increase font size a couple of times, and, save the settings.
These settings never get recalled when I open another code editor.  Is there
some way to get these settings persistent?

Enjoy,

Fred


On Fri, October 5, 2018 9:45 am, John Minter wrote:

> Open the Fiji Script editor. Select the Edit menu. Look in the 4th block of
> commands in that menu and you will find a pull-right option for Font Sizes.
> On my system, the list goes up to 42 points and there is an "other" option.
>
> Hope this helps.
>
> John
>
> On Fri, Oct 5, 2018 at 9:41 AM Aleksejs Fomins <[hidden email]>
> wrote:
>
>> 3) I like the FIJI editor, but I can't figure out how to increase its
>> Font Size. I have a huge monitor, and a lot of things are really small.
>> I mean, the Font of the code itself is easy to change, but how to change
>> the font of the code output, or the font size of the tabs like File |
>> Edit | Language?
>>
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: Learn scripting with ImageJ

Albert Cardona-2
In reply to this post by Aleksejs Fomins
Hi Aleksejs,

I wrote a Fiji python tutorial that touches on ROIs and CSV files, among many other points:

https://www.ini.uzh.ch/~acardona/fiji-tutorial/

Hosted by INI at UZH :)

For local help, I'd approach Moritz Kirschmann:

https://www.zmb.uzh.ch/en/aboutus/team/assistents/MoritzKirschmann.html

Best,

Albert


> On Oct 4, 2018, at 1:09 PM, Aleksejs Fomins <[hidden email]> wrote:
>
> Dear ImageJ,
>
> I have been using ImageJ for a while, but I never learned how to do
> scripting, and now I need it. I know python reasonably well, so I tried
> writing a script in python.
>
> My task is to use ImageJ to mark points on an image stack and save to
> CSV. Then open that CSV back into ImageJ, move some points around, and
> save again. Here is a full description of my problem on stackexchange
>
> https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s
>
> Can you please help me:
> 1) When I use python as a scripting language inside ImageJ, explain how
> I can find the syntax of a given operation. How can I find where a given
> class can be imported from?
> 2) Please help with problem on stack exchange.
>
> Best regards,
> Aleksejs Fomins
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

Re: Learn scripting with ImageJ

Aleksejs Fomins
In reply to this post by Fred Damen
Dear Fred, John,

Unfortunately, neither of your solutions help. I have increased

Edit->Options...->Appearance...=>Menu Font Size

and

Edit->Options=>Fonts

and

Script Editor -> Edit => Font Sizes

Neither of these options increases the font size of the File | Edit |
... panel in the code editor, nor does it increase the output font of
the code editor. It is however possible to change the font size of the
File | Edit | ... panel in the main Fiji window, which makes me think
that they are disjoint, and there are separate settings for the code
editor somewhere

Cheers,
Aleksejs



On 05.10.2018 23:43, Fred Damen wrote:

> In ImageJ(1) for the menus what you are looking for is:
> Edit->Options...->Appearance...=>Menu Font Size
>
> On Windows, if I change this from the default to 16, both the menu button and
> menu items increase in font size. If I increase to 18 and above the menu
> button font size decreases and the menu item size increases.
>
> On Linux/Windows/Mac, every time I open the code editor I change to a fixed
> width font, increase font size a couple of times, and, save the settings.
> These settings never get recalled when I open another code editor.  Is there
> some way to get these settings persistent?
>
> Enjoy,
>
> Fred
>
>
> On Fri, October 5, 2018 9:45 am, John Minter wrote:
>> Open the Fiji Script editor. Select the Edit menu. Look in the 4th block of
>> commands in that menu and you will find a pull-right option for Font Sizes.
>> On my system, the list goes up to 42 points and there is an "other" option.
>>
>> Hope this helps.
>>
>> John
>>
>> On Fri, Oct 5, 2018 at 9:41 AM Aleksejs Fomins <[hidden email]>
>> wrote:
>>
>>> 3) I like the FIJI editor, but I can't figure out how to increase its
>>> Font Size. I have a huge monitor, and a lot of things are really small.
>>> I mean, the Font of the code itself is easy to change, but how to change
>>> the font of the code output, or the font size of the tabs like File |
>>> Edit | Language?
>>>
>>>
>> --
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Learn scripting with ImageJ

Aleksejs Fomins
In reply to this post by Albert Cardona-2
Dear Albert,

Thanks for your suggestion. I have found your tutorial on google
beforehand, and studied it extensively. Unfortunately, it does not
answer the question on how to create unique ROI for unique slices,
that's why I decided to post here.

Thanks for the suggestion about Moritz Kirschmann, I'll try to find his
office.

Cheers,
Aleksejs


On 06.10.2018 14:44, Albert Cardona wrote:

> Hi Aleksejs,
>
> I wrote a Fiji python tutorial that touches on ROIs and CSV files, among many other points:
>
> https://www.ini.uzh.ch/~acardona/fiji-tutorial/
>
> Hosted by INI at UZH :)
>
> For local help, I'd approach Moritz Kirschmann:
>
> https://www.zmb.uzh.ch/en/aboutus/team/assistents/MoritzKirschmann.html
>
> Best,
>
> Albert
>
>
>> On Oct 4, 2018, at 1:09 PM, Aleksejs Fomins <[hidden email]> wrote:
>>
>> Dear ImageJ,
>>
>> I have been using ImageJ for a while, but I never learned how to do
>> scripting, and now I need it. I know python reasonably well, so I tried
>> writing a script in python.
>>
>> My task is to use ImageJ to mark points on an image stack and save to
>> CSV. Then open that CSV back into ImageJ, move some points around, and
>> save again. Here is a full description of my problem on stackexchange
>>
>> https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s
>>
>> Can you please help me:
>> 1) When I use python as a scripting language inside ImageJ, explain how
>> I can find the syntax of a given operation. How can I find where a given
>> class can be imported from?
>> 2) Please help with problem on stack exchange.
>>
>> Best regards,
>> Aleksejs Fomins
>>
>> --
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Learn scripting with ImageJ

Michael Schmid-3
Hi Aleksejs,

here is javascript sample code for adding a PointRoi at position (5,5)
to slice 5 and at (15,15) to slice 15.
I don't know much about python, but I guess the python code will be
essentially the same.


imp = IJ.openImage("http://wsr.imagej.net/images/t1-head.zip");
imp.show();  //show sample image
//imp = IJ.getImage();  //otherwise get the image where you want the roi

roi = new PointRoi(); //to initialize a new PointRoi
roi.resetCounters();  //probably not needed
imp. setSliceWithoutUpdate(5);
roi.addUserPoint(imp, 5, 5);
imp. setSliceWithoutUpdate(15);
roi.addUserPoint(imp, 15, 15);
imp.setRoi(roi);
imp.updateAndDraw();


For using the Java, Javascript or python API, if the Macro Recorder (in
Java/JavaScript mode) does not help, you can either see whether there is
an equivalent macro function and examine the code in
ij.macro.Functions.java to see what it does, or alternatively, one can
have a direct look at the java code. The latter usually requires a bit
of knowledge about the inner workings of ImageJ...

Michael
________________________________________________________________
On 08/10/2018 14:23, Aleksejs Fomins wrote:

> Dear Albert,
>
> Thanks for your suggestion. I have found your tutorial on google
> beforehand, and studied it extensively. Unfortunately, it does not
> answer the question on how to create unique ROI for unique slices,
> that's why I decided to post here.
>
> Thanks for the suggestion about Moritz Kirschmann, I'll try to find his
> office.
>
> Cheers,
> Aleksejs
>
>
> On 06.10.2018 14:44, Albert Cardona wrote:
>> Hi Aleksejs,
>>
>> I wrote a Fiji python tutorial that touches on ROIs and CSV files, among many other points:
>>
>> https://www.ini.uzh.ch/~acardona/fiji-tutorial/
>>
>> Hosted by INI at UZH :)
>>
>> For local help, I'd approach Moritz Kirschmann:
>>
>> https://www.zmb.uzh.ch/en/aboutus/team/assistents/MoritzKirschmann.html
>>
>> Best,
>>
>> Albert
>>
>>
>>> On Oct 4, 2018, at 1:09 PM, Aleksejs Fomins <[hidden email]> wrote:
>>>
>>> Dear ImageJ,
>>>
>>> I have been using ImageJ for a while, but I never learned how to do
>>> scripting, and now I need it. I know python reasonably well, so I tried
>>> writing a script in python.
>>>
>>> My task is to use ImageJ to mark points on an image stack and save to
>>> CSV. Then open that CSV back into ImageJ, move some points around, and
>>> save again. Here is a full description of my problem on stackexchange
>>>
>>> https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s
>>>
>>> Can you please help me:
>>> 1) When I use python as a scripting language inside ImageJ, explain how
>>> I can find the syntax of a given operation. How can I find where a given
>>> class can be imported from?
>>> 2) Please help with problem on stack exchange.
>>>
>>> Best regards,
>>> Aleksejs Fomins
>>>
>>> --
>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Learn scripting with ImageJ

Wayne Rasband-2
In reply to this post by Aleksejs Fomins
> On Oct 8, 2018, at 8:23 AM, Aleksejs Fomins <[hidden email]> wrote:
>
> Dear Albert,
>
> Thanks for your suggestion. I have found your tutorial on google
> beforehand, and studied it extensively. Unfortunately, it does not
> answer the question on how to create unique ROI for unique slices,
> that's why I decided to post here.

Here is JavaScript code that displays a point at the center of mass on each slice of the T1 Head sample image.

  img = IJ.openImage("http://wsr.imagej.net/images/t1-head.zip");
  overlay = new Overlay();
  stack = img.getStack();
  for (n=1; n<=stack.size(); n++) {
     ip = stack.getProcessor(n);
     stats = ip.getStatistics();
     point = new PointRoi(stats.xCenterOfMass,stats.yCenterOfMass);
     point.setPosition(n);
     point.setSize(3);
     overlay.add(point);
  }
  img.setOverlay(overlay);
  img.show();


-wayne


>
> Thanks for the suggestion about Moritz Kirschmann, I'll try to find his
> office.
>
> Cheers,
> Aleksejs
>
>
> On 06.10.2018 14:44, Albert Cardona wrote:
>> Hi Aleksejs,
>>
>> I wrote a Fiji python tutorial that touches on ROIs and CSV files, among many other points:
>>
>> https://www.ini.uzh.ch/~acardona/fiji-tutorial/
>>
>> Hosted by INI at UZH :)
>>
>> For local help, I'd approach Moritz Kirschmann:
>>
>> https://www.zmb.uzh.ch/en/aboutus/team/assistents/MoritzKirschmann.html
>>
>> Best,
>>
>> Albert
>>
>>
>>> On Oct 4, 2018, at 1:09 PM, Aleksejs Fomins <[hidden email]> wrote:
>>>
>>> Dear ImageJ,
>>>
>>> I have been using ImageJ for a while, but I never learned how to do
>>> scripting, and now I need it. I know python reasonably well, so I tried
>>> writing a script in python.
>>>
>>> My task is to use ImageJ to mark points on an image stack and save to
>>> CSV. Then open that CSV back into ImageJ, move some points around, and
>>> save again. Here is a full description of my problem on stackexchange
>>>
>>> https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s
>>>
>>> Can you please help me:
>>> 1) When I use python as a scripting language inside ImageJ, explain how
>>> I can find the syntax of a given operation. How can I find where a given
>>> class can be imported from?
>>> 2) Please help with problem on stack exchange.
>>>
>>> Best regards,
>>> Aleksejs Fomins
>>>
>>> --
>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Learn scripting with ImageJ

Curtis Rueden
In reply to this post by Fred Damen
Hi Aleksejs,

> Neither of these options increases the font size of the File | Edit |
> ... panel in the code editor, nor does it increase the output font of
> the code editor. It is however possible to change the font size of the
> File | Edit | ... panel in the main Fiji window, which makes me think
> that they are disjoint, and there are separate settings for the code
> editor somewhere

There is no separate option to control the font size. The Script Editor
uses a Swing JMenuBar, whereas the main ImageJ window uses an AWT MenuBar,
so there is some different in behavior and appearance.

Are you using Windows? Linux? Do you have a HiDPI display? If so, these
notes may interest you:

* https://imagej.net/Windows#HiDPI_displays
* https://imagej.net/Linux#HiDPI_displays

Finally, here is a Groovy script that changes the default font size of
JMenuBars:

--begin--
#@ Integer(label = "Menu font size", value = 20) fontSize
f = new java.awt.Font("sans-serif", java.awt.Font.PLAIN, fontSize)
javax.swing.UIManager.put("Menu.font", f)
javax.swing.UIManager.put("MenuItem.font", f)
javax.swing.UIManager.put("CheckBoxMenuItem.font", f)
javax.swing.UIManager.put("RadioButtonMenuItem.font", f)
--end--

Changes will persist until ImageJ is restarted.

Regards,
Curtis


On Mon, Oct 8, 2018, 07:24 Aleksejs Fomins <[hidden email]> wrote:

> Dear Fred, John,
>
> Unfortunately, neither of your solutions help. I have increased
>
> Edit->Options...->Appearance...=>Menu Font Size
>
> and
>
> Edit->Options=>Fonts
>
> and
>
> Script Editor -> Edit => Font Sizes
>
> Neither of these options increases the font size of the File | Edit |
> ... panel in the code editor, nor does it increase the output font of
> the code editor. It is however possible to change the font size of the
> File | Edit | ... panel in the main Fiji window, which makes me think
> that they are disjoint, and there are separate settings for the code
> editor somewhere
>
> Cheers,
> Aleksejs
>
>
>
> On 05.10.2018 23:43, Fred Damen wrote:
> > In ImageJ(1) for the menus what you are looking for is:
> > Edit->Options...->Appearance...=>Menu Font Size
> >
> > On Windows, if I change this from the default to 16, both the menu
> button and
> > menu items increase in font size. If I increase to 18 and above the menu
> > button font size decreases and the menu item size increases.
> >
> > On Linux/Windows/Mac, every time I open the code editor I change to a
> fixed
> > width font, increase font size a couple of times, and, save the
> settings.
> > These settings never get recalled when I open another code editor.  Is
> there
> > some way to get these settings persistent?
> >
> > Enjoy,
> >
> > Fred
> >
> >
> > On Fri, October 5, 2018 9:45 am, John Minter wrote:
> >> Open the Fiji Script editor. Select the Edit menu. Look in the 4th
> block of
> >> commands in that menu and you will find a pull-right option for Font
> Sizes.
> >> On my system, the list goes up to 42 points and there is an "other"
> option.
> >>
> >> Hope this helps.
> >>
> >> John
> >>
> >> On Fri, Oct 5, 2018 at 9:41 AM Aleksejs Fomins <[hidden email]>
> >> wrote:
> >>
> >>> 3) I like the FIJI editor, but I can't figure out how to increase its
> >>> Font Size. I have a huge monitor, and a lot of things are really small.
> >>> I mean, the Font of the code itself is easy to change, but how to
> change
> >>> the font of the code output, or the font size of the tabs like File |
> >>> Edit | Language?
> >>>
> >>>
> >> --
> >> 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
Reply | Threaded
Open this post in threaded view
|

Re: Learn scripting with ImageJ

Wayne Rasband-2
In reply to this post by Aleksejs Fomins
> On Oct 8, 2018, at 8:23 AM, Aleksejs Fomins <[hidden email]> wrote:
>
> Dear Albert,
>
> Thanks for your suggestion. I have found your tutorial on google
> beforehand, and studied it extensively. Unfortunately, it does not
> answer the question on how to create unique ROI for unique slices,
> that's why I decided to post here.

The following JavaScript example displays a point at the center of mass on each slice of the T1 Head sample image using a single PointRoi (with multiple points) instead of multiple PointRois in an Overlay. This makes it easier to move a point (by clicking on it and dragging) or to delete a point (by alt-clicking on it).

  img = IJ.openImage("http://wsr.imagej.net/images/t1-head.zip");
  points = new PointRoi();
  points.setSize(3);
  stack = img.getStack();
  for (n=1; n<=stack.size(); n++) {
     ip = stack.getProcessor(n);
     stats = ip.getStatistics();
     img.setSlice(n);
     points.addPoint(img,stats.xCenterOfMass,stats.yCenterOfMass);
  }
  img.setRoi(points);
  img.show();

-wayne

>
> On 06.10.2018 14:44, Albert Cardona wrote:
>> Hi Aleksejs,
>>
>> I wrote a Fiji python tutorial that touches on ROIs and CSV files, among many other points:
>>
>> https://www.ini.uzh.ch/~acardona/fiji-tutorial/
>>
>> Hosted by INI at UZH :)
>>
>> For local help, I'd approach Moritz Kirschmann:
>>
>> https://www.zmb.uzh.ch/en/aboutus/team/assistents/MoritzKirschmann.html
>>
>> Best,
>>
>> Albert
>>
>>
>>> On Oct 4, 2018, at 1:09 PM, Aleksejs Fomins <[hidden email]> wrote:
>>>
>>> Dear ImageJ,
>>>
>>> I have been using ImageJ for a while, but I never learned how to do
>>> scripting, and now I need it. I know python reasonably well, so I tried
>>> writing a script in python.
>>>
>>> My task is to use ImageJ to mark points on an image stack and save to
>>> CSV. Then open that CSV back into ImageJ, move some points around, and
>>> save again. Here is a full description of my problem on stackexchange
>>>
>>> https://stackoverflow.com/questions/52651917/how-to-import-csv-file-of-marked-points-into-fiji-and-place-it-on-the-correct-s
>>>
>>> Can you please help me:
>>> 1) When I use python as a scripting language inside ImageJ, explain how
>>> I can find the syntax of a given operation. How can I find where a given
>>> class can be imported from?
>>> 2) Please help with problem on stack exchange.
>>>
>>> Best regards,
>>> Aleksejs Fomins

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