Login  Register

How to modify the class file in ij.jar

Posted by jiajian shen on Apr 09, 2008; 7:16pm
URL: http://imagej.273.s1.nabble.com/How-to-modify-the-class-file-in-ij-jar-tp3696610.html

Hi All,

I want to do a ZProjection of Stacked UltraSound Images.   For each image in
the stack, I selected ROI by set pixel values of non ROI to zero.
 Basically, I want to get the average intensity projection of these ROIs.
However, the built in ZProject does not fit what I want.  Basically, the
"ZProject- Average Intensity" function do the averages on all the image
frame that not only contain ROIs.

To make the average only for the ROIs, I changed the ZProjector.java a
little bit in the average that only counted the non-zero pixel values (my
ROI).

the basic change is

kgood=0;

for(int i=0; i<len; i++) {

if (fpixels[i] > 0) kgood=kgood+1;

}

fnum=kgood;
Then I replace the ij.jar with the new ZProjector.class and
ZProjector$AverageIntensity.class.  However, when I restart ImageJ and do
the ZProjection, the average is not based on my ROI but still for all
pixels.

My question is that how can I modify the class file in ij.jar, and ImageJ
can recognize this change.  I also did one thing is to rename the ZProjector
as ZProjector_Shen.java and saved it in the folder "plugins".  However, when
I run the "ZProjector_Shen" in the Plugins menu, an error message comes out
as:
Plugin or class not found: "ZProjector_Shen"
(java.lang.NoClassDefFoundError: ZProjector_Shen (wrong name:
ij/plugin/ZProjector_Shen))

But I am sure the ZProjector_Shen.class in there, otherwise it won't shown
in the Plugins menubar.   Anyone knows why this error message came?

Thanks a lot,
Jason