Re: automated process

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

Re: automated process

Oran Kennedy
Hello,

I noticed from the below email that you can run a particular analysis for
each image in a folder by means of an automated process. Can anyone tell me
how to do that?

Many Thanks,

Oran

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Stella
Sim
Sent: 30 August 2005 10:50
To: [hidden email]
Subject: Re: Collecting Results from Results Box

Hi Brent,

If you store the measurements  in the result table(default), the data will
be appened to the result table everytime you run an image analysis anyway.
What I have done is that I put all the images of interest in one folder,
and run my image analysis for each image in the folder (automated proces),
results for each image were then appened to the same result table. After
finishing my analysis,  the content of the result table was saved to the
specified path.

I have also done in a slighly different way, instead of using the default
result table in ImageJ, I stored measurements in a text window...and use
append function to append the new measurements to the exisitng data....the
data wers stored in text format , and can be easily exported to a
database....I hope it help...


void writeResultMean(){
           if (mtwMean==null){
            titleMean = "Mean values";
            headingMean =
"Name\tWidth\tCount\tArea\tstd\tPerimeter\tstd\tAngle\tstd\tAR\tstd\tComp\ts
td\tRound\tstd\tForm
 Factor\tstd\tEq Diam\tstd";
            mtwMean = new TextWindow(titleMean, headingMean, aLineMean,
850, 180);
           }
             else mtwMean.append(aLineMean);
      }


Stella
Reply | Threaded
Open this post in threaded view
|

Re: automated process

Wayne Rasband
> I noticed from the below email that you can run a particular analysis
> for each image in a folder by means of an automated process.
> Can anyone tell me how to do that?

Use a macro such as the one at

     http://rsb.info.nih.gov/ij/macros/BatchMeasure.txt

-wayne
Reply | Threaded
Open this post in threaded view
|

Problems in completing a plugin

kiran kumar-2-3
Hello Group,
 
    I am writing a plugin for analysis and resolution of scanning electron microscope and about to release it to the group but I have few problems in completing the work. I would really appreciate if someone can help me in fixing the following problems.
 
Firstly, I am using Roimanager class and its functions for drawing multiple ROI's over an image.I get a strange error of  "Active image doesnt have a selection" when run my code for first time but for the second and third times it doesnt show up......i have pasted my code at end of this message.
 
 Secondly, I used decimal format class for rounding the float results to three decimal places but i couldnt see clearly the third number when i used showMessage command to display results and the third decimal point appears blurred.....
 
 Thirdly, I am calling threshod window for allowing the user to adjust the threshold of an FFT image, I used the wait command to give user limited time to adjust but i need to provide them unlimited time........how can i do it???
 
  I have attached the code of my plugin end of this message.
 
Thanks,
 
Regards,
 
Kiran Kumar
 
 
Here is the code of my plugin................
 
import ij.*;      //1
import ij.plugin.PlugIn;
import ij.plugin.filter.PlugInFilter;
import ij.process.*;
import java.awt.*;
import ij.gui.*;
import ij.gui.OvalRoi;
import java.lang.Math;
import java.util.Random;
import java.awt.Polygon;
import java.text.DecimalFormat;    //10
import ij.WindowManager;
import ij.IJ;
import ij.plugin.frame.RoiManager;
import ij.process.EllipseFitter;    
import ij.measure.*;
import ij.plugin.filter.*;
 
public class smart_ implements PlugInFilter {
 ImagePlus imp;     //20
 OvalRoi r1;
 
 DecimalFormat df = new DecimalFormat("0.###");
 public int setup(String arg, ImagePlus imp) {
  //this.imp = imp;
  if (arg.equals("about"))  //30
   {showAbout(); return DONE;}
  return DOES_8G+DOES_STACKS+SUPPORTS_MASKING;
 }
 public void run(ImageProcessor ip) {
 
  IJ.showMessage(" Scanning Microscope Analysis and Resolution Testing " );
 
  GenericDialog gd = new GenericDialog("Select one Method ");
  gd.addCheckbox("Manual Resolution Test ",true);
  gd.addCheckbox("Automeasure Resolution ",false);
  gd.addCheckbox("Resolution from Two Images ",false);
  gd.addCheckbox("S/N Ratio ",false);
  gd.showDialog();
  if(gd.wasCanceled()) {
   IJ.error("PlugIn canceled!");
   return;}
 
  boolean a,b,c,d;
  a = gd.getNextBoolean();
  b = gd.getNextBoolean();
  c = gd.getNextBoolean();
  d = gd.getNextBoolean();
 
  if(a== true & b == true | c == true & d == true | a== true & c == true | a== true & d == true | b== true & c == true | b== true & d == true ) {
  IJ.error("Select only one method ");
  return;}
  else if(a == true)
  Manual_Resolution(ip);
  else if(b == true)
  Automeasure_Resolution(ip);
  else if(c == true)
  TwoImage_Resolution(ip);
  else if(d == true)
  SNR_Calculation(ip);
 }
      //40
   
 
 
   public void Manual_Resolution(ImageProcessor ip) {
  Rectangle roi = ip.getRoi();
 
  //IJ.showMessage("width"+roi.width);
 
  if((roi!=null)&&(roi.width == roi.height))  {
  //RoiManager rm = new RoiManager();
  int PixCount = ip.getWidth();
  double widthum = IJ.getNumber("Enter Image width in um",1.0); /* get input from the user */
  IJ.showMessage("widthum="+widthum);
  double Pixperum = PixCount/widthum;
  IJ.showMessage("pixperum="+Pixperum);
  double Pixsize = 1000/Pixperum;
   
  int centerx = roi.x+roi.width/2;    /* setting center of ROI  */
  int centery = roi.y+roi.height/2;
  IJ.doCommand("FFT");
  IJ.wait(100);
  double rfactor = (1000*roi.width)/Pixperum;
  double rUser[] = { 0.1, 0.2, 0.3, 0.5, 0.7, 1, 1.5, 2, 2.5, 3, 4, 5, 7, 10, 20, 30, 50, 70, 100, 150 };  
  IJ.wait(100);
 
 
  /*  Draw the calibration rings */
 
  ImagePlus imp = WindowManager.getCurrentImage();  //70
  ip = imp.getProcessor();
  IJ.showMessage("Adjust threshold in 18 msecs");
  IJ.run("Threshold...");
  IJ.wait(18000);       //80
  IJ.showMessage("Threshold is done");
  RoiManager rm = new RoiManager();
  for( int m = 1; m<=20; m++) {
  int n = 20 - m;
  int radius = (int) Math.round((500*roi.width)/(Pixperum*rUser[n]));
  if((radius<roi.width/2) & (radius>roi.width/10)) {
  int x1 = (int) roi.width/2-radius;
  int y1 = (int) roi.height/2-radius;
  imp.setRoi( new OvalRoi(x1,y1,2*radius,2*radius,imp));  //90
  IJ.wait(100);
  rm.runCommand("Add");
  rm.runCommand("Add & Draw");
   
   
  /* Annotate the rings */
 
  double theta = 1.57*(1-Math.random());
  int radX = (int) Math.round(radius * Math.cos(theta)-1);
  int radY = (int) Math.round(radius * Math.sin(theta)-1);  //100
  ip.moveTo(roi.width/2+radX, roi.height/2-radY);
  ip.drawString(" "+rUser[n]);
       imp.updateAndDraw();
   
  }
     
      }      
       rm.runCommand("Draw");
       String Pixsize1 = df.format(Pixsize);
       IJ.showMessage("Pixel size (nm) =  "+Pixsize1 );
       IJ.selectWindow("ROI Manager");
               IJ.run("Close");
       IJ.selectWindow("Threshold");
               IJ.run("Close");
   }
 
  else {
        IJ.error("Select a square ROI of sizes 128,256,512 ");
   IJ.error("PlugIn canceled!");
   return;}
 
 }
 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
Reply | Threaded
Open this post in threaded view
|

binary texture

Martin du Saire
Hi,

I am looking for a method for measuring the granularity or clumpiness of a
binary image.  What I have come across so far (fractal dimension and
lacunarity, textual entropy, angular moments, inverse difference
moments...) but they all seem geared to grayscale, and computationally
expensive.  I will essentially be working with images like the
Particles.gif sample image ported with ImageJ.

Thanks for any suggestions

Martin
Reply | Threaded
Open this post in threaded view
|

Re: binary texture

Robert Dougherty
Martin,

Here is something totally made up.  It is supposed to give the relative
change in the mean when the Process/Filters/Maximum... filter is applied
with a radius of 0.5 pixel.  Experiments show some interesting properties.
It gives 4/L for collections of particles that all squares of side L pixels.
Lines of thickness T give approximately 2/T. (This is difficult to
demonstrate for diagonal lines with T > 1 because of ambiguities about
jaggies.  ImageJ seems to make diagonal lines that are too fat.  Rotating
horizontal lines and choosing the threshold to minimize the result gives the
expected macro output, but then the line looks too thin....) The macro
produces numbers that are usually in the range of .4 to .47 for subsets of
the particles.gif example.  Running Erode once on the whole image increases
the result from .4357 to .5104.

Bob

run("Set Measurements...", "  mean redirect=None decimal=4");
run("Measure");
mean1 = getResult("Mean", nResults-1);
run("Duplicate...", "title=temp");
run("Maximum...", "radius=.5");
run("Measure");
close();
mean2 = getResult("Mean", nResults-1);
if(mean1 == 0){
      print(0);
}else{
      percentChange = (mean2 - mean1)/mean1;
      print(percentChange);
}



Robert P. Dougherty, Ph.D.
President, OptiNav, Inc.
Phone (425) 467-1118
Fax (425) 467-1119
www.optinav.com
 

> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Martin du Saire
> Sent: Tuesday, August 30, 2005 2:12 PM
> To: [hidden email]
> Subject: binary texture
>
> Hi,
>
> I am looking for a method for measuring the granularity or clumpiness of a
> binary image.  What I have come across so far (fractal dimension and
> lacunarity, textual entropy, angular moments, inverse difference
> moments...) but they all seem geared to grayscale, and computationally
> expensive.  I will essentially be working with images like the
> Particles.gif sample image ported with ImageJ.
>
> Thanks for any suggestions
>
> Martin
Reply | Threaded
Open this post in threaded view
|

Re: binary texture

Martin du Saire
Thanks Bob, I will give it a shot.  It occurred to me that what I need to
calculate is something akin to a semivariogram...maybe

Martin

At 07:13 PM 8/30/2005, you wrote:

>Martin,
>
>Here is something totally made up.  It is supposed to give the relative
>change in the mean when the Process/Filters/Maximum... filter is applied
>with a radius of 0.5 pixel.  Experiments show some interesting properties.
>It gives 4/L for collections of particles that all squares of side L pixels.
>Lines of thickness T give approximately 2/T. (This is difficult to
>demonstrate for diagonal lines with T > 1 because of ambiguities about
>jaggies.  ImageJ seems to make diagonal lines that are too fat.  Rotating
>horizontal lines and choosing the threshold to minimize the result gives the
>expected macro output, but then the line looks too thin....) The macro
>produces numbers that are usually in the range of .4 to .47 for subsets of
>the particles.gif example.  Running Erode once on the whole image increases
>the result from .4357 to .5104.
>
>Bob
>
>run("Set Measurements...", "  mean redirect=None decimal=4");
>run("Measure");
>mean1 = getResult("Mean", nResults-1);
>run("Duplicate...", "title=temp");
>run("Maximum...", "radius=.5");
>run("Measure");
>close();
>mean2 = getResult("Mean", nResults-1);
>if(mean1 == 0){
>       print(0);
>}else{
>       percentChange = (mean2 - mean1)/mean1;
>       print(percentChange);
>}
>
>
>
>Robert P. Dougherty, Ph.D.
>President, OptiNav, Inc.
>Phone (425) 467-1118
>Fax (425) 467-1119
>www.optinav.com
>
>
> > -----Original Message-----
> > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> > Martin du Saire
> > Sent: Tuesday, August 30, 2005 2:12 PM
> > To: [hidden email]
> > Subject: binary texture
> >
> > Hi,
> >
> > I am looking for a method for measuring the granularity or clumpiness of a
> > binary image.  What I have come across so far (fractal dimension and
> > lacunarity, textual entropy, angular moments, inverse difference
> > moments...) but they all seem geared to grayscale, and computationally
> > expensive.  I will essentially be working with images like the
> > Particles.gif sample image ported with ImageJ.
> >
> > Thanks for any suggestions
> >
> > Martin