|
In the 1.43n version appear a different behavior in this code snippet:
in the 1.43m it draws a wideline, and returns the correspondent pixels values,
in 1.43n it draws a 1 pixel line and return the correspondent pixels values.
If you make the same operations in manual mode with the menus, it draws a correct wideline.
Thanks in advance
Alberto Duina
package contMensili;
import ij.IJ;
import ij.ImagePlus;
import ij.gui.Line;
import ij.gui.Roi;
import ij.io.Opener;
import ij.measure.Measurements;
import ij.plugin.PlugIn;
public class problemDemo_ implements PlugIn, Measurements {
public void run(String args) {
int c2x= 51;
int c2y= 36;
int d2x= 52;
int d2y= 192;
String path1="c:\\Dati\\Test\\uno.dcm";
Opener opener1 = new Opener();
ImagePlus imp1 = opener1.openImage(path1);
if (imp1 == null){
IJ.log("image "+path1+" not found");
return;
}
imp1.show();
double[] profiM1 = getLinePixels(imp1, c2x, c2y, d2x, d2y);
}
public double[] getLinePixels(ImagePlus imp1, int x1, int y1, int x2, int y2) {
Line.setWidth(1);
imp1.setRoi(new Line(x1, y1, x2, y2, imp1));
Line.setWidth(11);
imp1.updateAndDraw();
Roi roi1 = imp1.getRoi();
double[] profiM1 = ((Line) roi1).getPixels();
return profiM1;
}
|