How to modify the class file in ij.jar

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

How to modify the class file in ij.jar

jiajian shen
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
Reply | Threaded
Open this post in threaded view
|

Re: How to modify the class file in ij.jar

dscho
Hi,

On Wed, 9 Apr 2008, jiajian shen wrote:

> Plugin or class not found: "ZProjector_Shen"
> (java.lang.NoClassDefFoundError: ZProjector_Shen (wrong name:
> ij/plugin/ZProjector_Shen))

This means that you forgot to remove the "package ij.plugin;" statement
from your source.

Hth,
Dscho