Login  Register

Re: histogram of a surrounding sphere

Posted by m000an ZH on Feb 22, 2009; 6:35pm
URL: http://imagej.273.s1.nabble.com/histogram-of-a-surrounding-sphere-tp3693546p3693550.html

So obvious...  Thanks a lot, the plugin works perfectly!
Just a question: how getting the mean value directly instead of the full tab values?
Milan


> Date: Sun, 22 Feb 2009 12:04:35 +0100
> From: [hidden email]
> Subject: Re: histogram of a surrounding sphere
> To: [hidden email]
>
> Hi,
>
> You need first to rename your file to the same name as the class :
> HistoPixel3D_.java
>
> let's assume ij.jar and ij3d-bin.jar and the HistoPixel3D_.java file are
> in the same folder :
>
> javac -cp ij.jar:ij3d-bin.jar HistoPixel_.java
> use ; instead of : with Windows
>
> Thomas
>
>> Thomas,Thank you for your help! Unfortunately, being not a extremely confortable with java, I just can't compile the plugin (see below), although i use -cp ij.jar & ij3d-bin.jar
>> /Applications/ImageJ/plugins/My_Plugin.java:25: class HistoPixel3D_ is public, should be declared in a file named HistoPixel3D_.java
>> public class HistoPixel3D_ implements PlugInFilter {
>> Many thanksMilan
>>
>>  
>>> Date: Sat, 21 Feb 2009 18:31:09 +0100
>>> From: [hidden email]
>>> Subject: Re: histogram of a surrounding sphere
>>> To: [hidden email]
>>>
>>> Hi,
>>>
>>> You can use my ij3d API, here a simple plugin  to do that (beware a lot
>>> of text !!) :
>>>
>>> compile it using -cp ij.jar and ij3d-bin.jar
>>> http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:3d_binary_morphological_filters:start
>>>
>>> Hope this helps, tell me if you need more explanations.
>>>
>>> Thomas
>>>
>>>
>>>
>>> import ij.*;
>>> import ij.gui.*;
>>> import ij.measure.*;
>>> import ij.plugin.*;
>>> import ij.plugin.filter.*;
>>> import ij.process.*;
>>>
>>> import ij3d.image3d.*;
>>> import ij3d.utils.*;
>>>
>>> import java.awt.*;
>>> import java.awt.event.ItemEvent;
>>> import java.io.BufferedWriter;
>>> import java.io.FileWriter;
>>> import java.io.IOException;
>>> import java.text.*;
>>> import java.util.Enumeration;
>>> import java.util.Vector;
>>> /**
>>>  * Histogram for each pixel in 3D
>>>  *
>>>  *@author     Thomas BOUDIER
>>>  *@created    avril 2003
>>>  */
>>> public class HistoPixel3D_ implements PlugInFilter {
>>>     ImagePlus imp;
>>>     float rad;
>>>
>>>
>>>     /**
>>>      *  Main processing method for the Median3D_ object
>>>      *
>>>      *@param  ip  Description of the Parameter
>>>      */
>>>     public void run(ImageProcessor ip) {
>>>         rad = 5;
>>>         if (Dialogue()) {
>>>             TabUtil tab;
>>>             IntImage3D col = new IntImage3D(imp.getStack());
>>>             IJ.resetEscape();
>>>             for (int k = 0; k < col.getSizez(); k++) {
>>>                 if (IJ.escapePressed()) {
>>>                     break;
>>>                 }
>>>                 IJ.showStatus("3D Histo Pixel : " + (int) (100 * k /
>>> col.getSizez()) + "%");
>>>                 for (int j = 0; j < col.getSizey(); j++) {
>>>                     for (int i = 0; i < col.getSizex(); i++) {
>>>                         tab = col.getNeighborhoodSphere(i, j, k, rad,
>>> rad, rad);
>>>                         IJ.write("" + tab);
>>>                     }
>>>                 }
>>>             }
>>>
>>>         }
>>>     }
>>>
>>>
>>>     /**
>>>      *  Description of the Method
>>>      *
>>>      *@return    Description of the Return Value
>>>      */
>>>     private boolean Dialogue() {
>>>         GenericDialog gd = new GenericDialog("3D Histo Pixel");
>>>         gd.addNumericField("Radius", rad, 0);
>>>         gd.showDialog();
>>>         rad = (int) gd.getNextNumber();
>>>         return (!gd.wasCanceled());
>>>     }
>>>
>>>
>>>     /**
>>>      *  Description of the Method
>>>      *
>>>      *@param  arg  Description of the Parameter
>>>      *@param  imp  Description of the Parameter
>>>      *@return      Description of the Return Value
>>>      */
>>>     public int setup(String arg, ImagePlus imp) {
>>>         this.imp = imp;
>>>         return DOES_8G + DOES_16 + NO_CHANGES;
>>>     }
>>>
>>> }
>>>
>>>
>>>  
>>>    
>>>> Hi,In a 3D 8-bit stack (comes from tomography experiment), I would like to have for each point the histogram of the grey scale value of the surrounding voxels contained in a sphere (of 5 voxel radius for example) centered on the point.Any help is warmly welcome.Thank you
>>>> Milan
>>>> _________________________________________________________________
>>>> Découvrez la nouvelle génération des servives de Windows Live
>>>> http://download.live.com
>>>>
>>>>  
>>>>      
>>> --
>>> /*****************************************************/
>>>  Thomas Boudier, MCU Université Pierre et Marie Curie
>>>  UMR 7101 / IFR 83. Bat A 328, Campus Jussieu
>>>  Tél : 01 44 27 35 78  Fax : 01 44 27 25 08
>>> /*****************************************************/
>>>
>>>
>>>  
>>>    
>>
>> _________________________________________________________________
>> Découvrez la nouvelle génération des servives de Windows Live
>> http://download.live.com
>>
>>  
>
>
> --
> /*****************************************************/
>  Thomas Boudier, MCU Université Pierre et Marie Curie
>  UMR 7101 / IFR 83. Bat A 328, Campus Jussieu
>  Tél : 01 44 27 35 78  Fax : 01 44 27 25 08
> /*****************************************************/
>
>
>  

_________________________________________________________________
Découvrez la nouvelle génération des servives de Windows Live
http://download.live.com