本文整理汇总了Java中net.imglib2.img.ImagePlusAdapter.convertFloat方法的典型用法代码示例。如果您正苦于以下问题:Java ImagePlusAdapter.convertFloat方法的具体用法?Java ImagePlusAdapter.convertFloat怎么用?Java ImagePlusAdapter.convertFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.img.ImagePlusAdapter
的用法示例。
在下文中一共展示了ImagePlusAdapter.convertFloat方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void main( String[] args )
{
String srcImgFn = "/groups/jain/home/bogovicj/learning/advanced-imglib2/images/bee-1.tif";
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(srcImgFn) );
int[] sz = new int[]{ (int)img.dimension(0), (int)img.dimension(1) };
Img<FloatType> img2 = ImgOps.createGradientImgX( sz, new FloatType());
//imageStats( img );
//imageTextureStats( img );
// function that normalizes to range [0,1]
// Normalize<FloatType> nrmFun = new Normalize<FloatType>(
// 0, 255, 0, 1);
// evalFun( img, nrmFun );
// add the images
RealAdd<FloatType,FloatType,FloatType> sumfun = new RealAdd<FloatType,FloatType,FloatType>();
evalFun( img, img2, sumfun );
System.out.println("finished");
System.exit(0);
}
示例2: tryMatchRegistration
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void tryMatchRegistration()
{
String imgfn = "/data-ssd1/john/projects/crackSegmentation/crackVolDown_cp.tif";
String maskfn = "/data-ssd1/john/projects/crackSegmentation/Labels_ds_interp_cp_smooth.tif";
int[] patchSize = new int[] { 19, 19, 7 };
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>(
img, mask, patchSize);
cc.computeEdgels();
int i = cc.edgelIdxNearest(new double[]{67,290,13});
int j = cc.edgelIdxNearest(new double[]{69,311,13});
System.out.println(" i: " + i + " " + cc.getEdgels().get(i));
System.out.println(" j: " + j + " " + cc.getEdgels().get(j));
cc.debugOutDir = "/data-ssd1/john/projects/crackPatching/edgelRegPatch";
// cc.registerEdgelsOrient( cc.getEdgels().get(i), cc.getEdgels().get(j), i);
}
示例3: testClusteringReal
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void testClusteringReal(){
// String destDir = "/Users/bogovicj/Documents/projects/crackStitching/edgeClustering";
String destDir = "/groups/saalfeld/home/bogovicj/projects/crackStitching/edgeClustering/closeup";
// load a volume
int downSampleFactor = 4;
String imgfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/img_ds"+downSampleFactor+".tif";
String maskfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/labels_interp_smooth_ds"+downSampleFactor+".tif";
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
// cluster edgels
int[] patchSize = new int[]{ 9,9 };
CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>( img, mask, patchSize);
cc.computeEdgels();
System.out.println(" num edgels - " + cc.getEdgels().size());
EdgelMatching<FloatType> em = new EdgelMatching<FloatType>();
em.setSearchType( EdgelMatching.SearchTypes.COUNT );
em.setEdgelSearchCount(27);
em.setEdgels( cc.getEdgels() );
// EdgelClustering<FloatType> ec = new EdgelClustering<FloatType>( em );
EdgelClusteringRansac<FloatType> ec = new EdgelClusteringRansac<FloatType>( em );
ec.cluster();
Img<FloatType> clusterImg = img.factory().create( img, img.firstElement() );
ec.makeEdgelClusterImgMem(clusterImg);
ImgOps.writeFloat( clusterImg, destDir + File.separator + "edgelClusterImg.tif");
}
示例4: test2
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void test2(){
String imfn = "/groups/saalfeld/home/bogovicj/tests/testdat/boats.tif";
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imfn) );
double[] sigmas = new double[]{ 0, 0 };
double[] dsFactors = new double[]{ 1, 1 };
Img<FloatType> out = Resampling.resampleGaussian(
img,
img.factory(),
dsFactors, sigmas, sigmas);
ImgOps.writeFloat( out, "/groups/saalfeld/home/bogovicj/tests/testdat/boats_myds_1-1.tif");
}
示例5: main
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void main(String[] args) {
int downSampleFactor = 4;
// double searchRadius = 100;
int searchCount = 60;
String imgfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/img_ds"+downSampleFactor+".tif";
String maskfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/labels_interp_smooth_ds"+downSampleFactor+".tif";
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
// int[] patchSize = new int[] { 45, 45, 19 };
int[] patchSize = new int[] { 31, 31, 19 };
// int[] patchSize = new int[] { 15, 15, 13 };
CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>(
img, mask, patchSize);
EdgelMatching<FloatType> em = new EdgelMatching<FloatType>(img, mask, patchSize);
em.debugDir = "/data-ssd1/john/projects/crackPatching/cropEdgelMatch";
em.debugSuffix = "ds"+downSampleFactor;
em.setSearchType( EdgelMatching.SearchTypes.COUNT );
em.setEdgelSearchCount( searchCount );
// em.setEdgelSearchRadius( searchRadius / (downSampleFactor) );
cc.edgelMatcher = em;
cc.computeEdgels();
cc.edgelMatcher.setEdgels(cc.getEdgels());
EdgelClusteringRansac<FloatType> ec = new EdgelClusteringRansac<FloatType>(
cc.edgelMatcher);
ec.cluster( );
Img<FloatType> clusterImg = img.factory().create( img, img.firstElement());
// ec.makeEdgelClusterImg( clusterImg );
ec.makeEdgelClusterImgMem( clusterImg );
Format formatter = new SimpleDateFormat("yyyyMMdd-HHmmss");
String dtstr = formatter.format(Calendar.getInstance().getTime());
String fn = String.format("/groups/saalfeld/home/bogovicj/tmp/edgelClustersMemRansac_%s.tif", dtstr);
logger.info("fn: " + fn);
ImgOps.writeFloat( clusterImg, fn);
logger.info("finished");
System.exit(0);
}
示例6: main
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void main(String[] args) {
int downSampleFactor = 4;
// double searchRadius = 100;
int searchCount = 60;
String imgfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/img_ds"+downSampleFactor+".tif";
String maskfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/labels_interp_smooth_ds"+downSampleFactor+".tif";
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
// int[] patchSize = new int[] { 45, 45, 19 };
int[] patchSize = new int[] { 31, 31, 19 };
// int[] patchSize = new int[] { 15, 15, 13 };
CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>(
img, mask, patchSize);
EdgelMatching<FloatType> em = new EdgelMatching<FloatType>(img, mask, patchSize);
em.debugDir = "/data-ssd1/john/projects/crackPatching/cropEdgelMatch";
em.debugSuffix = "ds"+downSampleFactor;
em.setSearchType( EdgelMatching.SearchTypes.COUNT );
em.setEdgelSearchCount( searchCount );
// em.setEdgelSearchRadius( searchRadius / (downSampleFactor) );
cc.edgelMatcher = em;
cc.computeEdgels();
cc.edgelMatcher.setEdgels(cc.getEdgels());
EdgelClustering<FloatType> ec =
new EdgelClustering<FloatType>(
cc.edgelMatcher);
ec.cluster( );
Img<FloatType> clusterImg = img.factory().create( img, img.firstElement());
// ec.makeEdgelClusterImg( clusterImg );
ec.makeEdgelClusterImgMem( clusterImg );
Format formatter = new SimpleDateFormat("yyyyMMdd-HHmmss");
String dtstr = formatter.format(Calendar.getInstance().getTime());
String fn = String.format("/groups/saalfeld/home/bogovicj/tmp/edgelClustersMem_%s.tif", dtstr);
logger.info("fn: " + fn);
ImgOps.writeFloat( clusterImg, fn);
/* CHECK CONFLICT CONDITION METHOD */
// System.out.println( "A A S :" + isConflict( CLASSA, CLASSA, true));
// System.out.println( "A B S :" + isConflict( CLASSA, CLASSB, true));
// System.out.println( "A A D :" + isConflict( CLASSA, CLASSA, false));
// System.out.println( "A B D :" + isConflict( CLASSA, CLASSB, false));
logger.info("finished");
System.exit(0);
}
示例7: checkImport
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void checkImport(){
String maskfn = "/groups/jain/home/bogovicj/projects/crackSegmentation/Labels_ds_interp_cp_smooth.tif";
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
// ArrayList<Integer> set = ImgUtil.uniqueInt(mask);
// Collections.sort(set);
// System.out.println("set: " + set);
// RandomAccess<UnsignedByteType> ra = mask.randomAccess();
RandomAccess<FloatType> ra = mask.randomAccess();
ra.setPosition(new int[]{207,137,9});
System.out.println("val: " + ra.get());
}
示例8: edgelFeatures
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void edgelFeatures()
{
int downSampleFactor = 4;
double searchRadius = 100;
// double searchRadius = 50;
String imgfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/img_ds"+downSampleFactor+".tif";
String maskfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/labels_interp_smooth_ds"+downSampleFactor+".tif";
// String featurefn = "/data-ssd1/john/projects/crackPatching/closeup/ds_4_patch_31-31-19/edgelFeatures.csv";
// int[] patchSize = new int[] { 31, 31, 19 };
String featurefn = "/data-ssd1/john/projects/crackPatching/closeup/ds_4_patch_15-15-9/edgelFeatures.csv";
int[] patchSize = new int[] { 15, 15, 9 };
double[] testPt = new double[]{ 159,253,73 };
double[] resPt = new double[]{ 170, 312, 136 };
ArrayUtil.divide(testPt, downSampleFactor);
ArrayUtil.divide(resPt, downSampleFactor);
double[] diff = ArrayUtil.clone(resPt);
ArrayUtil.subtractInPlace(diff, testPt);
double dist = Math.sqrt(ArrayUtil.sumSquares(diff));
System.out.println( " dist " + dist);
ArrayUtil.divide( testPt, (double)downSampleFactor);
System.out.println( "testPt: " + ArrayUtil.printArray(testPt));
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>(
img, mask, patchSize);
cc.computeEdgels();
EdgelMatching<FloatType> em = new EdgelMatching<FloatType>(img, mask, patchSize);
em.debugDir = "/data-ssd1/john/projects/crackPatching/cropEdgelMatch";
em.debugSuffix = "ds"+downSampleFactor;
// em.debugSuffix = "";
// em.setSearchType( EdgelMatching.SearchTypes.COUNT );
// em.setEdgelSearchCount(3000);
em.setEdgelSearchRadius( searchRadius / (downSampleFactor) );
em.setEdgels(cc.getEdgels());
try {
em.computeAndWriteEdgelsAndFeatures(featurefn);
} catch (IOException e) {
e.printStackTrace();
}
}
示例9: tryMatching
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void tryMatching()
{
// String imgfn = "/data-ssd1/john/projects/crackSegmentation/crackVolDown_cp.tif";
// String maskfn = "/data-ssd1/john/projects/crackSegmentation/Labels_ds_interp_cp_smooth.tif";
int downSampleFactor = 4;
double searchRadius = 100;
// double searchRadius = 50;
// String imgfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/img.tif";
// String maskfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/labels_interp_smooth.tif";
String imgfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/img_ds"+downSampleFactor+".tif";
String maskfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/labels_interp_smooth_ds"+downSampleFactor+".tif";
int[] patchSize = new int[] { 31, 31, 21 };
double[] testPt = new double[]{ 159,253,73 };
double[] resPt = new double[]{ 170, 312, 136 };
ArrayUtil.divide(testPt, downSampleFactor);
ArrayUtil.divide(resPt, downSampleFactor);
double[] diff = ArrayUtil.clone(resPt);
ArrayUtil.subtractInPlace(diff, testPt);
double dist = Math.sqrt(ArrayUtil.sumSquares(diff));
System.out.println( " dist " + dist);
ArrayUtil.divide( testPt, (double)downSampleFactor);
System.out.println( "testPt: " + ArrayUtil.printArray(testPt));
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>(
img, mask, patchSize);
cc.computeEdgels();
// cc.edgelIdxImg();
// ArrayList<Edgel> edgels = cc.getEdgels();
// int i =0;
// for ( Edgel e : edgels ){
// System.out.println( ArrayUtil.printArray( e.getPosition() ));
//
// if(i>50) break;
// }
EdgelMatching<FloatType> em = new EdgelMatching<FloatType>(img, mask, patchSize);
em.debugDir = "/data-ssd1/john/projects/crackPatching/cropEdgelMatch";
em.debugSuffix = "ds"+downSampleFactor;
// em.debugSuffix = "";
// em.setSearchType( EdgelMatching.SearchTypes.COUNT );
// em.setEdgelSearchCount(3000);
em.setEdgelSearchRadius( searchRadius / (downSampleFactor) );
em.setEdgels(cc.getEdgels());
// em.computeAllAffinities();
// em.testAffinitiesReg();
int testEdgelIdx = cc.edgelIdxNearest(testPt);
em.debug_i = testEdgelIdx;
Edgel testEdgel = cc.getEdgels().get(testEdgelIdx);
em.computeAffinities( testEdgel );
}
示例10: edgelTypeValidate
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void edgelTypeValidate() {
String maskfn = "/data-ssd1/john/projects/crackSegmentation/Labels_ds_interp_cp_smooth.tif";
ArrayImgFactory<FloatType> ffactory = new ArrayImgFactory<FloatType>();
ArrayImgFactory<DoubleType> dfactory = new ArrayImgFactory<DoubleType>();
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
float thresh = 40.0f;
ArrayList<Edgel> edgels = SubpixelEdgelDetection.getEdgels(mask, ffactory, thresh);
// ArrayList<EdgelFloat> edgelsf = SubpixelEdgelDetectionFloat.getEdgels(mask, ffactory, thresh);
System.out.println(" edgels size: " + edgels.size());
// System.out.println(" edgels float size: " + edgelsf.size());
for(int i=0; i<20; i++){
System.out.println("d " + edgels.get(i) );
// System.out.println("f " + edgelsf.get(i) );
System.out.println(" ");
}
}
示例11: testEdgelView
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void testEdgelView(){
int downSampleFactor = 2;
String imgfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/img_ds"+downSampleFactor+".tif";
String maskfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/labels_interp_smooth_ds"+downSampleFactor+".tif";
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
Edgel e = new Edgel( new double[]{87.07,103.04,204.02},
new double[]{0.83,0.52,0.20}, 72.03 );
int[] patchSize = new int[]{43,43,19};
RealTransformRandomAccessible<FloatType, InverseRealTransform> view = EdgelTools.edgelToView(e, mask, patchSize);
Img<FloatType> imgOut = img.factory().create(patchSize, img.firstElement());
ImgOps.copyInto( view, imgOut );
ImgOps.writeFloat(imgOut, "/groups/jain/home/bogovicj/tmp/edgelView.tif");
}
示例12: checkEdgelPosition
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void checkEdgelPosition()
{
String imgfn = "/groups/jain/home/bogovicj/projects/crackSegmentation/crackVolDown_cp.tif";
// String maskfn = "/groups/jain/home/bogovicj/projects/crackSegmentation/Labels_ds_interp_cp.tif";
String maskfn = "/groups/jain/home/bogovicj/projects/crackSegmentation/Labels_ds_interp_cp_smooth.tif";
String edgelMaskPrefix = "/groups/jain/home/bogovicj/projects/crackSegmentation/edgelValidate/edgelMask_1";
int[] patchSize = new int[]{7,7,3};
int[] patchMidPt = PatchTools.patchSizeToMidpt(patchSize);
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
// Img<UnsignedByteType> mask = null;
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>(
img, mask, patchSize);
cc.computeEdgels();
ArrayList<Edgel> edgels = cc.getEdgels();
double[] pos = new double[]{206,137,9};
int i = cc.edgelIdxNearest(pos);
Edgel edgel = edgels.get(i);
logger.info(" " + edgel);
}
示例13: checkEdgelType
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void checkEdgelType()
{
String imgfn = "/groups/jain/home/bogovicj/projects/crackSegmentation/crackVolDown_cp.tif";
// String maskfn = "/groups/jain/home/bogovicj/projects/crackSegmentation/Labels_ds_interp_cp.tif";
String maskfn = "/groups/jain/home/bogovicj/projects/crackSegmentation/Labels_ds_interp_cp_smooth.tif";
String edgelMaskPrefix = "/groups/jain/home/bogovicj/projects/crackSegmentation/edgelValidate/edgelMask_1";
String crackMaskRewriteFn = "/groups/jain/home/bogovicj/projects/crackSegmentation/edgelValidate/crackMaskOut.tif";
ArrayImgFactory<UnsignedByteType> ubfactory = new ArrayImgFactory<UnsignedByteType>();
ArrayImgFactory<IntType> ifactory = new ArrayImgFactory<IntType>();
ArrayImgFactory<FloatType> ffactory = new ArrayImgFactory<FloatType>();
int[] patchSize = new int[]{7,7,3};
int[] patchMidPt = PatchTools.patchSizeToMidpt(patchSize);
// Img<UnsignedByteType> mask = null;
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
ArrayList<Edgel> edgels = SubpixelEdgelDetection.getEdgels(mask, mask.factory(), 10.0f);
logger.info("num edgels " + edgels.size());
double[] pos = new double[]{206,137,9};
ImgOps.write(mask, crackMaskRewriteFn);
CrackCorrection cc = new CrackCorrection();
cc.setEdgels(edgels);
int i = cc.edgelIdxNearest(pos);
Edgel edgel = edgels.get(i);
logger.info(" " + edgel );
}
示例14: main
import net.imglib2.img.ImagePlusAdapter; //导入方法依赖的package包/类
public static void main(String[] args) {
int downSampleFactor = 4;
double searchRadius = 100;
int searchCount = 2000;
String imgfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/img_ds"+downSampleFactor+".tif";
String maskfn = "/data-ssd1/john/projects/crackSegmentation/groundTruth/closeup/labels_interp_smooth_ds"+downSampleFactor+".tif";
Img<FloatType> img = ImagePlusAdapter.convertFloat( IJ.openImage(imgfn) );
Img<FloatType> mask = ImagePlusAdapter.convertFloat( IJ.openImage(maskfn) );
// int[] patchSize = new int[] { 45, 45, 19 };
int[] patchSize = new int[] { 31, 31, 19 };
// int[] patchSize = new int[] { 15, 15, 13 };
CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>(
img, mask, patchSize);
EdgelMatching<FloatType> em = new EdgelMatching<FloatType>(img, mask, patchSize);
em.debugDir = "/data-ssd1/john/projects/crackPatching/cropEdgelMatch";
em.debugSuffix = "ds"+downSampleFactor;
cc.edgelMatcher = em;
cc.edgelMatcher.setEdgelSearchRadius( searchRadius / (downSampleFactor) );
// cc.edgelMatcher.setSearchType( EdgelMatching.SearchTypes.COUNT );
// cc.edgelMatcher.setEdgelSearchCount( searchCount );
cc.computeEdgels();
cc.edgelMatcher.setEdgels(cc.getEdgels());
// makeLapEdgeImg( cc, downSampleFactor );
testEdgelMatchesWrite( cc, downSampleFactor );
// edgelPatchWrite( cc, downSampleFactor );
// edgelFeatures();
// tryMatching();
// tryMatchRegistration();
// stupdidRadiusSearchTest();
//
// edgelTypeValidate();
System.out.println("execution finished");
System.exit(0);
}