本文整理汇总了Java中ij.process.FloatProcessor.convertToFloat方法的典型用法代码示例。如果您正苦于以下问题:Java FloatProcessor.convertToFloat方法的具体用法?Java FloatProcessor.convertToFloat怎么用?Java FloatProcessor.convertToFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.process.FloatProcessor
的用法示例。
在下文中一共展示了FloatProcessor.convertToFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Image_Segmented
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
* Create the SME_ENS_Kmeans_Engine segmented image and display it
*
* @param kmeansLabels : the array containing the labels obtained thanks to Kmeans_
* @return : returns the Image matrix which will be used as a Map for the Adaptive Gaussian Filtering
*/
public float[][] Image_Segmented(double[] kmeansLabels) {
int x, y;
ImageProcessor ip_ = stack.getProcessor(1); // Done just to have W and H of one image
int W = ip_.getWidth(); // Get the image width
int H = ip_.getHeight(); // Get the image height
this.Map2DImage = new float[W][H];
for (x = 0; x < W; x++) { //Go through x coordinates
for (y = 0; y < H; y++) { //Go through y coordinates
int k = y * W + x;
Map2DImage[x][y] = (float) kmeansLabels[k];
}
}
//Image Display in a new window
FloatProcessor fp3 = new FloatProcessor(Map2DImage);
ImageProcessor ip3 = fp3.convertToFloat();
ip3.setFloatArray(Map2DImage);
ImagePlus imp3 = new ImagePlus("SME_ENS_Kmeans_Engine Segmented Image" + imp.getTitle(), ip3);
imp3.setProcessor(ip3);
this.imp3 = imp3;
//imp3.show();
return Map2DImage;
}
示例2: Image_Segmented
import ij.process.FloatProcessor; //导入方法依赖的package包/类
/**
* Create the SME_ENS_Kmeans_Engine segmented image and display it
*
* @param kmeansLabels : the array containing the labels obtained thanks to Kmeans_
* @return : returns the Image matrix which will be used as a Map for the Adaptive Gaussian Filtering
*/
public float[][] Image_Segmented(double[] kmeansLabels) {
int x, y;
ImageProcessor ip_ = sme_pluginGetManifold.getStack1().getProcessor(1); // Done just to have W and H of one image
int W = ip_.getWidth(); // Get the image width
int H = ip_.getHeight(); // Get the image height
sme_pluginGetManifold.setMap2DImage( new float[W][H]);
for (x = 0; x < W; x++) { //Go through x coordinates
for (y = 0; y < H; y++) { //Go through y coordinates
int k = y * W + x;
sme_pluginGetManifold.getMap2DImage()[x][y] = (float) kmeansLabels[k];
}
}
//Image Display in a new window
FloatProcessor fp3 = new FloatProcessor(sme_pluginGetManifold.getMap2DImage());
ImageProcessor ip3 = fp3.convertToFloat();
ip3.setFloatArray(sme_pluginGetManifold.getMap2DImage());
ImagePlus imp3 = new ImagePlus("SME_ENS_Kmeans_Engine Segmented Image" + sme_pluginGetManifold.getImp().getTitle(), ip3);
imp3.setProcessor(ip3);
sme_pluginGetManifold.setImp3(imp3);
//imp3.show();
return sme_pluginGetManifold.getMap2DImage();
}