about macro

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

about macro

Pavita
Hi, all

i want to write macro that can

-open all image file in folder -> i don't know command that open many  
image file in folder

-analyze particle in each image -> i write already.

-save summarize window result from analyze particle -> i don't know  
command that save summarize window and rename it automatic for save in  
another folder.


i should be study about command of macro from where? anyone can  
suggest me (some web or some book) ?


Regard,

Pavita
Reply | Threaded
Open this post in threaded view
|

Re: about macro

donny008
hello i will try to help with the knowledge i have


//to open a folder and then process each object within the folder
function convert(format);
        dir1 = getDirectory("Choose Source Directory ");
    list = getFileList(dir1);

for (i=0; i<list.length; i++)
        {
//set true to avoid opening all the images
setBatchMode(true);
showProgress(i+1, list.length);
        open(dir1+list[i]);


}
//to save the results window as an excel file
selectWindow("Results");
saveAs("Measurements", "");



On Thu, Jun 25, 2009 at 9:34 PM, Pavita Tipsombatboon <
[hidden email]> wrote:

> Hi, all
>
> i want to write macro that can
>
> -open all image file in folder -> i don't know command that open many image
> file in folder
>
> -analyze particle in each image -> i write already.
>
> -save summarize window result from analyze particle -> i don't know command
> that save summarize window and rename it automatic for save in another
> folder.
>
>
> i should be study about command of macro from where? anyone can suggest me
> (some web or some book) ?
>
>
> Regard,
>
> Pavita
>



--
Donny George
Reply | Threaded
Open this post in threaded view
|

OpenDialog with multiple default extensions?

Joachim Wesner
In reply to this post by Pavita
Hi list,

maybe it´s a silly question, but I don´t seem to find a solution, also not
in the list archive and docs:

Is it possible to have an OpenDialog that display a limited number of
default file extensions instead of one fixed default filename resp. "*.*"?

I would like to limit the filetypes to only certain selections, with
probably "*.*" as the ultimate choice. This is very easy with Windows
itself, even on a very low level.
Can I do it with OpenDialog or is there a replacement?

Thanks

Joachim

Mit freundlichen Grüßen / Best regards

Joachim Wesner
Projektleiter Optik Technologiesysteme

Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy
Martyr | Colin Davis


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: OpenDialog with multiple default extensions?

Michael Schmid
Hi Joachim,

as far as I can say, ImageJ OpenDialog does not support it.

java.awt.FileDialog has a setFilenameFilter method. There, you can  
check for, e.g., endsWith(".jpg") etc. I think that you can't modify  
the filter while the dialog box is open.
For a user-defined filter, you need the javax.swing.JFileChooser.


The downside of using java.awt.FileDialog or  
javax.swing.JFileChooser: no interfacing to the ImageJ macro langage  
unless you add code for it yourself. Also, the ImageJ default  
directory is not set.


Michael
________________________________________________________________

On 30 Jun 2009, at 19:49, Joachim Wesner wrote:

> Hi list,
>
> maybe it´s a silly question, but I don´t seem to find a solution,  
> also not
> in the list archive and docs:
>
> Is it possible to have an OpenDialog that display a limited number of
> default file extensions instead of one fixed default filename resp.  
> "*.*"?
>
> I would like to limit the filetypes to only certain selections, with
> probably "*.*" as the ultimate choice. This is very easy with Windows
> itself, even on a very low level.
> Can I do it with OpenDialog or is there a replacement?
>
> Thanks
>
> Joachim
>
> Mit freundlichen Grüßen / Best regards
>
> Joachim Wesner
> Projektleiter Optik Technologiesysteme
Reply | Threaded
Open this post in threaded view
|

Re: OpenDialog with multiple default extensions?

ctrueden
Hi Joachim,

Michael is correct that java.awt.FileDialog does not support the notion of
user-selectable file filters.

FYI, Bio-Formats provides a JFileChooser with configurable file filters
according to supported file formats, as well as (optional) preview icons for
selected files. You can see it in action by running loci_tools.jar from the
command line ("java -jar loci_tools.jar") and choosing Open from the File
menu. You can also use it in your own GPL code; see the
loci.formats.gui.GUITools.buildFileChooser(*) methods.

Cheers,
Curtis

On Tue, Jun 30, 2009 at 1:05 PM, Michael Schmid <[hidden email]>wrote:

> Hi Joachim,
>
> as far as I can say, ImageJ OpenDialog does not support it.
>
> java.awt.FileDialog has a setFilenameFilter method. There, you can check
> for, e.g., endsWith(".jpg") etc. I think that you can't modify the filter
> while the dialog box is open.
> For a user-defined filter, you need the javax.swing.JFileChooser.
>
>
> The downside of using java.awt.FileDialog or javax.swing.JFileChooser: no
> interfacing to the ImageJ macro langage unless you add code for it yourself.
> Also, the ImageJ default directory is not set.
>
>
> Michael
> ________________________________________________________________
>
>
> On 30 Jun 2009, at 19:49, Joachim Wesner wrote:
>
>  Hi list,
>>
>> maybe it´s a silly question, but I don´t seem to find a solution, also not
>> in the list archive and docs:
>>
>> Is it possible to have an OpenDialog that display a limited number of
>> default file extensions instead of one fixed default filename resp. "*.*"?
>>
>> I would like to limit the filetypes to only certain selections, with
>> probably "*.*" as the ultimate choice. This is very easy with Windows
>> itself, even on a very low level.
>> Can I do it with OpenDialog or is there a replacement?
>>
>> Thanks
>>
>> Joachim
>>
>> Mit freundlichen Grüßen / Best regards
>>
>> Joachim Wesner
>> Projektleiter Optik Technologiesysteme
>>
>
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: OpenDialog with multiple default extensions?

Joachim Wesner
Hi Curtis and Michael,

thanx for the info. Yes the correct expression is actually a "file filter"
here.

I was/am actually a bit confused (resp. expected more) because the standard
OpenDialog when using JFileChooser seems to already handle correctly a
*single* extension as
a respective file filter resp "file type" and displays the appropriate
dialog, so I thought adding more extensions would be very easy.

I have taken a look at the OpneDialog source code and the filter examples
on the Java tutorials page and probably can come up with an extended,
"backward compatible"
OpenDialog, let´s see if/when I get some more time to work on it.

Thanx again

Mit freundlichen Grüßen / Best regards

Joachim Wesner
Projektleiter Optik Technologiesysteme


Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy
Martyr | Colin Davis


                                                                           
             Curtis Rueden                                                
             <[hidden email]                                            
             U>                                                         An
             Gesendet von:              [hidden email]                
             ImageJ Interest                                         Kopie
             Group                                                        
             <[hidden email].                                       Thema
             GOV>                       Re: OpenDialog with multiple      
                                        default extensions?                
                                                                           
             30.06.2009 20:14                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                    
              ImageJ Interest                                              
                   Group                                                  
             <[hidden email].                                            
                   GOV>                                                    
                                                                           
                                                                           




Hi Joachim,

Michael is correct that java.awt.FileDialog does not support the notion of
user-selectable file filters.

FYI, Bio-Formats provides a JFileChooser with configurable file filters
according to supported file formats, as well as (optional) preview icons
for
selected files. You can see it in action by running loci_tools.jar from the
command line ("java -jar loci_tools.jar") and choosing Open from the File
menu. You can also use it in your own GPL code; see the
loci.formats.gui.GUITools.buildFileChooser(*) methods.

Cheers,
Curtis

On Tue, Jun 30, 2009 at 1:05 PM, Michael Schmid
<[hidden email]>wrote:

> Hi Joachim,
>
> as far as I can say, ImageJ OpenDialog does not support it.
>
> java.awt.FileDialog has a setFilenameFilter method. There, you can check
> for, e.g., endsWith(".jpg") etc. I think that you can't modify the filter
> while the dialog box is open.
> For a user-defined filter, you need the javax.swing.JFileChooser.
>
>
> The downside of using java.awt.FileDialog or javax.swing.JFileChooser: no
> interfacing to the ImageJ macro langage unless you add code for it
yourself.

> Also, the ImageJ default directory is not set.
>
>
> Michael
> ________________________________________________________________
>
>
> On 30 Jun 2009, at 19:49, Joachim Wesner wrote:
>
>  Hi list,
>>
>> maybe it´s a silly question, but I don´t seem to find a solution, also
not
>> in the list archive and docs:
>>
>> Is it possible to have an OpenDialog that display a limited number of
>> default file extensions instead of one fixed default filename resp.
"*.*"?

>>
>> I would like to limit the filetypes to only certain selections, with
>> probably "*.*" as the ultimate choice. This is very easy with Windows
>> itself, even on a very low level.
>> Can I do it with OpenDialog or is there a replacement?
>>
>> Thanks
>>
>> Joachim
>>
>> Mit freundlichen Grüßen / Best regards
>>
>> Joachim Wesner
>> Projektleiter Optik Technologiesysteme
>>
>



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: about macro

Pavita
In reply to this post by donny008
Thank you Donny George, for your answer

now, i can open many image and process with it but i still cannot save  
summarize window.
from this command --->

run("Analyze Particles...", "size=0-Infinity pixel  
circularity=0.00-1.00 show=Outlines summarize");
                               
How to select,save as or clear summarize window from this process?

it's not Results window.

regard,

Pavita


On Jun 26, 2009, at 12:54 PM, Donny George wrote:

> hello i will try to help with the knowledge i have
>
>
> //to open a folder and then process each object within the folder
> function convert(format);
>        dir1 = getDirectory("Choose Source Directory ");
>    list = getFileList(dir1);
>
> for (i=0; i<list.length; i++)
>        {
> //set true to avoid opening all the images
> setBatchMode(true);
> showProgress(i+1, list.length);
>        open(dir1+list[i]);
>
>
> }
> //to save the results window as an excel file
> selectWindow("Results");
> saveAs("Measurements", "");
>
>
>
> On Thu, Jun 25, 2009 at 9:34 PM, Pavita Tipsombatboon <
> [hidden email]> wrote:
>
>> Hi, all
>>
>> i want to write macro that can
>>
>> -open all image file in folder -> i don't know command that open  
>> many image
>> file in folder
>>
>> -analyze particle in each image -> i write already.
>>
>> -save summarize window result from analyze particle -> i don't know  
>> command
>> that save summarize window and rename it automatic for save in  
>> another
>> folder.
>>
>>
>> i should be study about command of macro from where? anyone can  
>> suggest me
>> (some web or some book) ?
>>
>>
>> Regard,
>>
>> Pavita
>>
>
>
>
> --
> Donny George
Reply | Threaded
Open this post in threaded view
|

Re: about macro

Jan Eglinger-5
Hi Pavita,


Pavita Tipsombatboon wrote:
> run("Analyze Particles...", "size=0-Infinity pixel circularity=0.00-1.00
> show=Outlines summarize");
>                
> How to select,save as or clear summarize window from this process?
>

did you try to run
  selectWindow("Summary");

before saving the window as text file:
  saveAs("Text", "/path/to/your/folder/"+"filename.xls");

or to close the window:
  selectWindow("Summary");
  close();



Hope that helps,
Jan
Reply | Threaded
Open this post in threaded view
|

Re: about macro

Pavita
Thank you Jan,

I can save summary window to .xls file. but i think

selectWindow("Summary");
close();

doesn't work, because i cannot close summary window for recalculate in  
next image.

Because i want to recalculate other image in folder,So i must clear  
previous data before recalculate.
How to clear data on Summary window?

Regard,
Pavita

On Jul 9, 2009, at 4:19 PM, Jan Eglinger wrote:

> Hi Pavita,
>
>
> Pavita Tipsombatboon wrote:
>> run("Analyze Particles...", "size=0-Infinity pixel  
>> circularity=0.00-1.00
>> show=Outlines summarize");
>>
>> How to select,save as or clear summarize window from this process?
>>
>
> did you try to run
>  selectWindow("Summary");
>
> before saving the window as text file:
>  saveAs("Text", "/path/to/your/folder/"+"filename.xls");
>
> or to close the window:
>  selectWindow("Summary");
>  close();
>
>
>
> Hope that helps,
> Jan
Reply | Threaded
Open this post in threaded view
|

Re: about macro

Gabriel Lapointe
Hi Pavita,
close(); will only work with images. to close a table you have to use:
run("Close");

Gabriel Lapointe

Pavita Tipsombatboon wrote:

> Thank you Jan,
>
> I can save summary window to .xls file. but i think
>
> selectWindow("Summary");
> close();
>
> doesn't work, because i cannot close summary window for recalculate in
> next image.
>
> Because i want to recalculate other image in folder,So i must clear
> previous data before recalculate.
> How to clear data on Summary window?
>
> Regard,
> Pavita
>
> On Jul 9, 2009, at 4:19 PM, Jan Eglinger wrote:
>
>> Hi Pavita,
>>
>>
>> Pavita Tipsombatboon wrote:
>>> run("Analyze Particles...", "size=0-Infinity pixel
>>> circularity=0.00-1.00
>>> show=Outlines summarize");
>>>
>>> How to select,save as or clear summarize window from this process?
>>>
>>
>> did you try to run
>>  selectWindow("Summary");
>>
>> before saving the window as text file:
>>  saveAs("Text", "/path/to/your/folder/"+"filename.xls");
>>
>> or to close the window:
>>  selectWindow("Summary");
>>  close();
>>
>>
>>
>> Hope that helps,
>> Jan
>
Reply | Threaded
Open this post in threaded view
|

strange behaviour when opening files

Johannes-P. Koch
Dear all,

I experience a strange behaviour upon opening files using the "Open
As..."-Windows command (i.e. clicking on the file in the Windows explorer
with a right click, then "Open As..." ...). In previous ImageJ versions
(1.42o) all files were opened in the same ImageJ; now (1.43b), the images
are all opened in new ImageJ programs. So, I have to use ImageJ's command
"Open...". Sometimes, this is quite disturbing especially when one is
working on files stored in "far away" directories.
I could observe this behaviour on Windows XP (SP3) and Windows Vista (SP2).

Any ideas?

Thanks

Johannes


--
Ich verwende die kostenlose Version von SPAMfighter für private Anwender,
die bei mir bis jetzt 461 Spammails entfernt hat.
Rund 6 Millionen Leute nutzen SPAMfighter schon.
Laden Sie SPAMfighter kostenlos herunter: http://www.spamfighter.com/lde
Reply | Threaded
Open this post in threaded view
|

Re: strange behaviour when opening files

Wayne Rasband
On Jul 9, 2009, at 8:31 AM, Johannes-P. KOCH wrote:

> Dear all,
>
> I experience a strange behaviour upon opening files using the "Open
> As..."-Windows command (i.e. clicking on the file in the Windows
> explorer with a right click, then "Open As..." ...). In previous
> ImageJ versions (1.42o) all files were opened in the same ImageJ; now
> (1.43b), the images are all opened in new ImageJ programs. So, I have
> to use ImageJ's command "Open...". Sometimes, this is quite disturbing
> especially when one is working on files stored in "far away"
> directories.
> I could observe this behaviour on Windows XP (SP3) and Windows Vista
> (SP2).

You can avoid this problem by enabling "Run socket listener" in
Edit>Options>Misc.

-wayne