Filtering images

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

Filtering images

Kay Ajayi
I've about 1000 images and my intention is filter them. Here is a sample of
the original image: http://www.mypicx.com/11122009/Orignal_image/

and the sample of the filtered image is
this:http://www.mypicx.com/11122009/Filtered_image/

Here is my macros:
run("Brightness/Contrast...");
setMinAndMax(0, 140);
run("Apply LUT");
run("Sigma Filter Plus", "radius=4 use=3 minimum=1");
setAutoThreshold();
//run("Threshold...");
setThreshold(0, 168);
run("Convert to Mask");

However, if another 1000 images, I'll have to do another macros. How best I
can go about do this imageJ which automatically gives me the filtered image.

Regards,
Reply | Threaded
Open this post in threaded view
|

Antwort: Filtering images

Joachim Wesner
Hi,

I do not fully understand what exactly your problem is, as it seems that
you already successfully filtered 1000 images!?

Is it:

1) How to apply a plugin or macro to a larger number of images
automatically, probably saving the result under a different filename?

OR

2) How to easily adjust some constants in a "fixed" macro without the need
to rewrite the macro any time?

In the case of 1) I do not know if there is a built-in way, but i think it
wouldn´t be too difficult to come up with a plugin that does just that:

Ask for a filename specification and runs a plugin on all images and
resaves them

(maybe specifying the filename by a filter string "*xa*bl.dat" (like Import
Image sequence) or from a text file with all the filenames in question

Such a plugin it would be very useful in many cases IMHO

Maybe somebody will correct me here and already has a flexible ready-to-run
solution

You COULD use the already existing Image Importer to convert your images to
one HUGE(virtual) stack, than you can run automatically apply one plugin
to ALL slices of a stack and resave the slices.... IIRC

In case of 2) you could use a dialog (take a look oin the docs), to avoid
that it later pops up a 1000 times you can later supply those values as
arguments of the plugin/macro,
take a look at what the macro recorder generates if you run your plugin
with a dialog


Joachim Wesner



                                                                           
             Olukayode Ajayi                                              
             <colenajayi@GMAIL                                            
             .COM>                                                      An
             Gesendet von:              [hidden email]                
             ImageJ Interest                                         Kopie
             Group                                                        
             <[hidden email].                                       Thema
             GOV>                       Filtering images                  
                                                                           
                                                                           
             12.11.2009 07:54                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                    
              ImageJ Interest                                              
                   Group                                                  
             <[hidden email].                                            
                   GOV>                                                    
                                                                           
                                                                           




I've about 1000 images and my intention is filter them. Here is a sample of
the original image: http://www.mypicx.com/11122009/Orignal_image/

and the sample of the filtered image is
this:http://www.mypicx.com/11122009/Filtered_image/

Here is my macros:
run("Brightness/Contrast...");
setMinAndMax(0, 140);
run("Apply LUT");
run("Sigma Filter Plus", "radius=4 use=3 minimum=1");
setAutoThreshold();
//run("Threshold...");
setThreshold(0, 168);
run("Convert to Mask");

However, if another 1000 images, I'll have to do another macros. How best I
can go about do this imageJ which automatically gives me the filtered
image.

Regards,



______________________________________________________________________
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
|

AW: Filtering images

Jörg Hammel
In reply to this post by Kay Ajayi
Hi,

If I understood your problem correct, you have a number of images in a
folder you want to process with the macro you specified below? If your
images are in standard file format (bmp, jpeg, tiff, etc.) I have a macro,
which we developed for this purpose to processes all files in a folder and
saves them to another one after filtering with the same file name.

Best

                 Jörg


-----Ursprüngliche Nachricht-----
Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von
Olukayode Ajayi
Gesendet: Donnerstag, 12. November 2009 07:55
An: [hidden email]
Betreff: Filtering images

I've about 1000 images and my intention is filter them. Here is a sample of
the original image: http://www.mypicx.com/11122009/Orignal_image/

and the sample of the filtered image is
this:http://www.mypicx.com/11122009/Filtered_image/

Here is my macros:
run("Brightness/Contrast...");
setMinAndMax(0, 140);
run("Apply LUT");
run("Sigma Filter Plus", "radius=4 use=3 minimum=1");
setAutoThreshold();
//run("Threshold...");
setThreshold(0, 168);
run("Convert to Mask");

However, if another 1000 images, I'll have to do another macros. How best I
can go about do this imageJ which automatically gives me the filtered image.

Regards,
 

__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 4598
(20091112) __________

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com
 
 

__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 4598
(20091112) __________

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com
 
Reply | Threaded
Open this post in threaded view
|

Re: Filtering images

Kota Miura
In reply to this post by Kay Ajayi
Hi Olukayode,

from the menu, select

Process -> Batch -> Macro...

then in the panel, do three things

1. "Input" field: select the folder where your 1000 images are

2. "Output" field:select a folder where you want to save processed images

3. paste your macro in the bottom field.

then click "process" button at the right-bottom corner.

you might need the latest version ImageJ.

cheers,
Kota

Olukayode Ajayi wrote:

> I've about 1000 images and my intention is filter them. Here is a sample of
> the original image: http://www.mypicx.com/11122009/Orignal_image/
>
> and the sample of the filtered image is
> this:http://www.mypicx.com/11122009/Filtered_image/
>
> Here is my macros:
> run("Brightness/Contrast...");
> setMinAndMax(0, 140);
> run("Apply LUT");
> run("Sigma Filter Plus", "radius=4 use=3 minimum=1");
> setAutoThreshold();
> //run("Threshold...");
> setThreshold(0, 168);
> run("Convert to Mask");
>
> However, if another 1000 images, I'll have to do another macros. How best I
> can go about do this imageJ which automatically gives me the filtered image.
>
> Regards,
>
>
>  

--
-------------------------------------------------------------
Dr. Kota Miura

Scientist & IT Engineer
Centre for Molecular and Cellular Imaging,
European Molecular Biology Laboratory
Meyerhofstr. 1
69117 Heidelberg
GERMANY

Tel +49 6221 387 404
Fax +49 6221 387 512
http://www.embl.org/cmci/
-------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

AW Re: Filtering images

Joachim Wesner
Hi Kota,

>from the menu, select

>Process -> Batch -> Macro...

>then in the panel, do three things

>1. "Input" field: select the folder where your 1000 images are

>2. "Output" field:select a folder where you want to save processed images

>3. paste your macro in the bottom field.

>then click "process" button at the right-bottom corner.


thanx a lot, too, I missed that valuable new feature, just what I was
thinking of!


Joachim


______________________________________________________________________
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: Filtering images

Richard VanMetter
In reply to this post by Kay Ajayi
I notice that the 'Process -> Batch -> Macro' option no longer appears on my
menu?! I am running ImageJ 1.42q. I remember it being there in the past...
and wonder why it no longer appears. I have no idea when it disappeared as I
rarely use it.

Does anyone know why I no longer find it?

Rich VanMetter
Reply | Threaded
Open this post in threaded view
|

Re: Filtering images

Michael Schmid
Hi Rich,

you should upgrade to the latest version. The Process>Batch commands  
were added only recently (starting with 1.43e). 1.42q is at least 2  
or 3 months to old.

Michael
________________________________________________________________

On 13 Nov 2009, at 18:40, Richard VanMetter wrote:

> I notice that the 'Process -> Batch -> Macro' option no longer  
> appears on my
> menu?! I am running ImageJ 1.42q. I remember it being there in the  
> past...
> and wonder why it no longer appears. I have no idea when it  
> disappeared as I
> rarely use it.
>
> Does anyone know why I no longer find it?
>
> Rich VanMetter
Reply | Threaded
Open this post in threaded view
|

Re: Filtering images

Mike Esterman
In reply to this post by Jörg Hammel
Jorg
Is your macro published on the Image J website or elsewhere?

Mike


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jörg
Hammel
Sent: Thursday, November 12, 2009 6:22 AM
To: [hidden email]
Subject: AW: Filtering images

Hi,

If I understood your problem correct, you have a number of images in a
folder you want to process with the macro you specified below? If your
images are in standard file format (bmp, jpeg, tiff, etc.) I have a macro,
which we developed for this purpose to processes all files in a folder and
saves them to another one after filtering with the same file name.

Best

                 Jörg


-----Ursprüngliche Nachricht-----
Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von
Olukayode Ajayi
Gesendet: Donnerstag, 12. November 2009 07:55
An: [hidden email]
Betreff: Filtering images

I've about 1000 images and my intention is filter them. Here is a sample of
the original image: http://www.mypicx.com/11122009/Orignal_image/

and the sample of the filtered image is
this:http://www.mypicx.com/11122009/Filtered_image/

Here is my macros:
run("Brightness/Contrast...");
setMinAndMax(0, 140);
run("Apply LUT");
run("Sigma Filter Plus", "radius=4 use=3 minimum=1");
setAutoThreshold();
//run("Threshold...");
setThreshold(0, 168);
run("Convert to Mask");

However, if another 1000 images, I'll have to do another macros. How best I
can go about do this imageJ which automatically gives me the filtered image.

Regards,
 

__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 4598
(20091112) __________

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com
 
 

__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 4598
(20091112) __________

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com
 
Reply | Threaded
Open this post in threaded view
|

Re: Filtering images

Kay Ajayi
Thanks for your contribution. The macros are developed by me. My question is
how can I get the filtered image in imageJ without having a macro. For
instance, the macro is specifically for 1000images. I am just thinking if
i've another set of 1000 images and the appropriateness of that macros is
not questioned. So, I am looking for an option that will be applicable any
image.

On Sat, Nov 14, 2009 at 11:47 AM, Mike Esterman <[hidden email]> wrote:

> Jorg
> Is your macro published on the Image J website or elsewhere?
>
> Mike
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jörg
> Hammel
> Sent: Thursday, November 12, 2009 6:22 AM
> To: [hidden email]
> Subject: AW: Filtering images
>
> Hi,
>
> If I understood your problem correct, you have a number of images in a
> folder you want to process with the macro you specified below? If your
> images are in standard file format (bmp, jpeg, tiff, etc.) I have a macro,
> which we developed for this purpose to processes all files in a folder and
> saves them to another one after filtering with the same file name.
>
> Best
>
>                  Jörg
>
>
> -----Ursprüngliche Nachricht-----
> Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von
> Olukayode Ajayi
> Gesendet: Donnerstag, 12. November 2009 07:55
> An: [hidden email]
> Betreff: Filtering images
>
> I've about 1000 images and my intention is filter them. Here is a sample of
> the original image: http://www.mypicx.com/11122009/Orignal_image/
>
> and the sample of the filtered image is
> this:http://www.mypicx.com/11122009/Filtered_image/
>
> Here is my macros:
> run("Brightness/Contrast...");
> setMinAndMax(0, 140);
> run("Apply LUT");
> run("Sigma Filter Plus", "radius=4 use=3 minimum=1");
> setAutoThreshold();
> //run("Threshold...");
> setThreshold(0, 168);
> run("Convert to Mask");
>
> However, if another 1000 images, I'll have to do another macros. How best I
> can go about do this imageJ which automatically gives me the filtered
> image.
>
> Regards,
>
>
> __________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 4598
> (20091112) __________
>
> E-Mail wurde geprüft mit ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> __________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 4598
> (20091112) __________
>
> E-Mail wurde geprüft mit ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
Reply | Threaded
Open this post in threaded view
|

AW: Filtering images

Jörg Hammel
Hi Kay,

I have pasted your macro in another one we use in our lab to process folders
with varying numbers of images (e.g. filtering, mask creation). It is
independent of the number of images in the folder. At the moment the macro
saves the images in bmp format but you can easily change this. You may try
this:

//Batch Processor

// ***Select macro(s) used here ***
// Just replace "bmp" by "jpeg" or any other standard image file format here
to select output type of your filtered image

  macro "Batch Convert to BMP" {convert("bmp");}

//Function Batch processing
  function convert(format) {
      requires("1.34m");

// *** General Settings ***

       
// Close log window if open
        if (isOpen("Log")) {
         selectWindow("Log");
         run("Close");
        }

//Variables
        var abort,dir1,dir2,dir3,rad;

// Instruction
        showMessage("Instruction", "Choose source diretory containing
source-files \nand destination directories for Filtered IMAGE. \n \nBrougt
to you 2007 by porifera.net\n \n");

// ### Input your values for specific functions here ###

// ### End Input specific functions ###


// Choose directories
      dir1 = getDirectory("Choose source image directory ");
      dir2 = getDirectory("Choose FILTERED IMAGE destination directory ");
      List = getFileList(dir1);
     


               
// Protocol start
        print("ImageJ macro 'Batch_Processor' by porifera.net \n \n");
        print("initial file source directory: ",dir1, "\n");
        print("filtered file destination directory: ", dir2,"\n");
        print("Number of files:", list.length, "\n \n");

// Batch processing
      setBatchMode(true);
      count = 0;
    countFiles(dir1);
    n = 0;
    processFiles(dir1);
     
      function countFiles(dir1) {
      list = getFileList(dir1);
      for (i=0; i<list.length; i++) {
          if (endsWith(list[i], "/"))
              countFiles(""+dir1+list[i]);
          else
              count++;
      }
  }



   function processFiles(dir1) {
      list = getFileList(dir1);
      for (i=0; i<list.length; i++) {
          if (endsWith(list[i], "/"))
              processFiles(""+dir1+list[i]);
          else {
             showProgress(n++, count);
             path = dir1+list[i];
             processFile(path);
          }
      }
  }

  function processFile(path) {
       if (endsWith(path, "")) {
           open(path);
           initimage = getTitle();

 

// *** Insertion specific operations ***

               
                run("Brightness/Contrast...");
                setMinAndMax(0, 140);
                run("Apply LUT");
                run("Sigma Filter Plus", "radius=4 use=3 minimum=1");
                setAutoThreshold(); //run("Threshold..."); setThreshold(0,
168);
                run("Convert to Mask");



// *** End Insertion specific operations ***



// Save and close images
       
        // Safe and close FILTERED IMAGE
          selectWindow(initimage);
          //saveAs(format, dir2+list[i]);
          close();


//Print progress report
print("processed file ", list[i]);

      }
  }

//Final message progress report
print("successfully processed ", list.length, " files");
showMessage("Batch processing finished");

  }


macro "Abort" {
       abort = true;
}





Best, Joerg



-----Ursprüngliche Nachricht-----
Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von Kay
Ajayi
Gesendet: Dienstag, 17. November 2009 03:38
An: [hidden email]
Betreff: Re: Filtering images

Thanks for your contribution. The macros are developed by me. My question is
how can I get the filtered image in imageJ without having a macro. For
instance, the macro is specifically for 1000images. I am just thinking if
i've another set of 1000 images and the appropriateness of that macros is
not questioned. So, I am looking for an option that will be applicable any
image.

On Sat, Nov 14, 2009 at 11:47 AM, Mike Esterman <[hidden email]> wrote:

> Jorg
> Is your macro published on the Image J website or elsewhere?
>
> Mike
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jörg
> Hammel
> Sent: Thursday, November 12, 2009 6:22 AM
> To: [hidden email]
> Subject: AW: Filtering images
>
> Hi,
>
> If I understood your problem correct, you have a number of images in a
> folder you want to process with the macro you specified below? If your
> images are in standard file format (bmp, jpeg, tiff, etc.) I have a macro,
> which we developed for this purpose to processes all files in a folder and
> saves them to another one after filtering with the same file name.
>
> Best
>
>                  Jörg
>
>
> -----Ursprüngliche Nachricht-----
> Von: ImageJ Interest Group [mailto:[hidden email]] Im Auftrag von
> Olukayode Ajayi
> Gesendet: Donnerstag, 12. November 2009 07:55
> An: [hidden email]
> Betreff: Filtering images
>
> I've about 1000 images and my intention is filter them. Here is a sample
of

> the original image: http://www.mypicx.com/11122009/Orignal_image/
>
> and the sample of the filtered image is
> this:http://www.mypicx.com/11122009/Filtered_image/
>
> Here is my macros:
> run("Brightness/Contrast...");
> setMinAndMax(0, 140);
> run("Apply LUT");
> run("Sigma Filter Plus", "radius=4 use=3 minimum=1");
> setAutoThreshold();
> //run("Threshold...");
> setThreshold(0, 168);
> run("Convert to Mask");
>
> However, if another 1000 images, I'll have to do another macros. How best
I
> can go about do this imageJ which automatically gives me the filtered
> image.
>
> Regards,
>
>
> __________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version
4598
> (20091112) __________
>
> E-Mail wurde geprüft mit ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> __________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version
4598
> (20091112) __________
>
> E-Mail wurde geprüft mit ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
 

__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 4613
(20091116) __________

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com
 
 

__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 4613
(20091116) __________

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com