本文整理汇总了Java中net.imglib2.img.ImagePlusAdapter类的典型用法代码示例。如果您正苦于以下问题:Java ImagePlusAdapter类的具体用法?Java ImagePlusAdapter怎么用?Java ImagePlusAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImagePlusAdapter类属于net.imglib2.img包,在下文中一共展示了ImagePlusAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
public static < T extends RealType< T > & NativeType< T >> void main( final String[] args )
{
ImageJ.main( args );
final File file = new File( "DrosophilaWing.tif" );
final ImagePlus imp = IJ.openImage( file.getAbsolutePath() );
final Img< T > img = ImagePlusAdapter.wrap( imp );
final long start = System.currentTimeMillis();
final Shape shape = new DiamondTipsShape( 10 );
final Img< T > target = Dilation.dilate( img, shape, 1 );
final long end = System.currentTimeMillis();
System.out.println( "Processing done in " + ( end - start ) + " ms." );
ImageJFunctions.show( img );
ImageJFunctions.show( target );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:21,代码来源:DiamondTipsNeighborhoodTest.java
示例2: 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);
}
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:24,代码来源:OpsExamples.java
示例3: 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);
}
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:24,代码来源:EdgelMatchingExps.java
示例4: createImgLib2
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
public static FloatImagePlus< net.imglib2.type.numeric.real.FloatType > createImgLib2( final List< float[] > img, final int w, final int h )
{
final ImagePlus imp;
if ( img.size() > 1 )
{
final ImageStack stack = new ImageStack( w, h );
for ( int z = 0; z < img.size(); ++z )
stack.addSlice( new FloatProcessor( w, h, img.get( z ) ) );
imp = new ImagePlus( "ImgLib2 FloatImagePlus (3d)", stack );
}
else
{
imp = new ImagePlus( "ImgLib2 FloatImagePlus (2d)", new FloatProcessor( w, h, img.get( 0 ) ) );
}
return ImagePlusAdapter.wrapFloat( imp );
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:19,代码来源:InteractiveDoG.java
示例5: produceNoiseImage
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
/**
* Creates a noisy image that is created by repeatedly adding points
* with random intensity to the canvas. That way it tries to mimic the
* way a microscope produces images.
*
* @param <T> The wanted output type.
* @param width The image width.
* @param height The image height.
* @param dotSize The size of the dots.
* @param numDots The number of dots.
* @param smoothingSigma The two dimensional sigma for smoothing.
* @return The noise image.
*/
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> produceNoiseImage(int width,
int height, float dotSize, int numDots) {
/* For now (probably until ImageJ2 is out) we use an
* ImageJ image to draw circles.
*/
int options = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY;
ImagePlus img = NewImage.createByteImage("Noise", width, height, 1, options);
ImageProcessor imp = img.getProcessor();
float dotRadius = dotSize * 0.5f;
int dotIntSize = (int) dotSize;
for (int i=0; i < numDots; i++) {
int x = (int) (Math.random() * width - dotRadius);
int y = (int) (Math.random() * height - dotRadius);
imp.setColor(Color.WHITE);
imp.fillOval(x, y, dotIntSize, dotIntSize);
}
// we changed the data, so update it
img.updateImage();
// create the new image
RandomAccessibleInterval<T> noiseImage = ImagePlusAdapter.wrap(img);
return noiseImage;
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:39,代码来源:TestImageAccessor.java
示例6: createRectengularMaskImage
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
/**
* Creates a mask image with a black background and a white
* rectangular foreground.
*
* @param width The width of the result image.
* @param height The height of the result image.
* @param offset The offset of the rectangular mask.
* @param size The size of the rectangular mask.
* @return A black image with a white rectangle on it.
*/
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> createRectengularMaskImage(
long width, long height, long[] offset, long[] size) {
/* For now (probably until ImageJ2 is out) we use an
* ImageJ image to draw lines.
*/
int options = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY;
ImagePlus img = NewImage.createByteImage("Noise", (int)width, (int)height, 1, options);
ImageProcessor imp = img.getProcessor();
imp.setColor(Color.WHITE);
Roi rect = new Roi(offset[0], offset[1], size[0], size[1]);
imp.fill(rect);
// we changed the data, so update it
img.updateImage();
return ImagePlusAdapter.wrap(img);
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:28,代码来源:TestImageAccessor.java
示例7: createImagePlusImage
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
private ByteImagePlus<UnsignedByteType> createImagePlusImage(final ImageProcessor ip) {
if ( dimensions.length == 1 )
return null;
if ( ip != null )
{
final ImagePlus imp = new ImagePlus("image", ip);
return ImagePlusAdapter.wrapByte(imp);
}
if ( dimensions[ 0 ] * dimensions[ 1 ] > Integer.MAX_VALUE )
return null;
if ( numDimensions > 5 )
return null;
final ByteImagePlus<UnsignedByteType> imagePlusContainer = ( ByteImagePlus<UnsignedByteType> ) createImage( dimensions, new ImagePlusImgFactory< UnsignedByteType >() );
return imagePlusContainer;
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:16,代码来源:ImglibBenchmark.java
示例8: main
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
public static void main( final String[] args )
{
final int delta = 15;
final long minSize = 10;
final long maxSize = 100*100;
final double maxVar = 0.8;
final double minDiversity = 0;
final Img< UnsignedByteType > img;
try
{
new ImageJ();
IJ.run("Lena (68K)");
IJ.run("8-bit");
img = ImagePlusAdapter.wrapByte( IJ.getImage() );
}
catch ( final Exception e )
{
e.printStackTrace();
return;
}
final ImagePlus impImg = IJ.getImage();
final ImageStack stack = new ImageStack( (int) img.dimension( 0 ), (int) img.dimension( 1 ) );
final MserTree< UnsignedByteType > treeDarkToBright = MserTree.buildMserTree( img, new UnsignedByteType( delta ), minSize, maxSize, maxVar, minDiversity, true );
final MserTree< UnsignedByteType > treeBrightToDark = MserTree.buildMserTree( img, new UnsignedByteType( delta ), minSize, maxSize, maxVar, minDiversity, false );
final MserTreeExample< UnsignedByteType > vis = new MserTreeExample< UnsignedByteType >( impImg, stack );
vis.visualise( treeDarkToBright, Color.CYAN );
vis.visualise( treeBrightToDark, Color.MAGENTA );
final ImagePlus imp = new ImagePlus("components", stack);
imp.show();
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:35,代码来源:MserTreeExample.java
示例9: main
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
public static < T extends RealType< T > & NativeType< T >> void main( final String[] args )
{
ImageJ.main( args );
final File file = new File( "DrosophilaWing.tif" );
// final File file = new File(
// "/Users/JeanYves/Desktop/Data/brightblobs.tif" );
final ImagePlus imp = IJ.openImage( file.getAbsolutePath() );
final Img< T > img = ImagePlusAdapter.wrap( imp );
final long start = System.currentTimeMillis();
final Shape shape = new PairOfPointsShape( new long[] { -10, 20 } );
final Img< T > target = Dilation.dilate( img, shape, 1 );
final long end = System.currentTimeMillis();
System.out.println( "Processing done in " + ( end - start ) + " ms." );
ImageJFunctions.show( img );
ImageJFunctions.show( target );
final Shape shape2 = new PairOfPointsShape( new long[] { 10, -20 } );
final Img< T > target2 = Dilation.dilate( img, shape2, 1 );
ImageJFunctions.show( target2 );
final Shape shape3 = new PairOfPointsShape( new long[] { 10, 20 } );
final Img< T > target3 = Dilation.dilate( img, shape3, 1 );
ImageJFunctions.show( target3 );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:32,代码来源:PairOfPointsNeighborhoodTest.java
示例10: 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");
}
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:33,代码来源:EdgelClusteringTests.java
示例11: 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");
}
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:14,代码来源:ResamplingTests.java
示例12: run
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
@Override
public void run(String arg) {
ImagePlus imp1 = IJ.openImage("/Users/dan/Documents/Dresden/ipf/colocPluginDesign/red.tif");
img1 = ImagePlusAdapter.wrap(imp1);
ImagePlus imp2 = IJ.openImage("/Users/dan/Documents/Dresden/ipf/colocPluginDesign/green.tif");
img2 = ImagePlusAdapter.wrap(imp2);
double pearson = calculatePearson();
Img<T> ranImg = generateRandomImageStack(img1, new int[] {2,2,1});
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:12,代码来源:ColocImgLibGadgets.java
示例13: createMasksAndRois
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
/**
* Creates appropriate data structures from the ROI information
* passed. If an irregular ROI is found, it will be put into a
* frame of its bounding box size and put into an {@code Image<T>}.
*
* In the end the members ROIs, masks and maskBBs will be
* filled if ROIs or masks were found. They will be null
* otherwise.
*/
protected void createMasksAndRois(final Roi[] rois, final int width,
final int height)
{
// create empty list
masks.clear();
for (final Roi r : rois) {
final MaskInfo mi = new MaskInfo();
// add it to the list of masks/ROIs
masks.add(mi);
// get the ROIs/masks bounding box
final Rectangle rect = r.getBounds();
mi.roi = new BoundingBox(new long[] { rect.x, rect.y }, new long[] {
rect.width, rect.height });
final ImageProcessor ipMask = r.getMask();
// check if we got a regular ROI and return if so
if (ipMask == null) {
continue;
}
// create a mask processor of the same size as a slice
final ImageProcessor ipSlice = ipMask.createProcessor(width, height);
// fill the new slice with black
ipSlice.setValue(0.0);
ipSlice.fill();
// position the mask on the new mask processor
ipSlice.copyBits(ipMask, (int) mi.roi.offset[0], (int) mi.roi.offset[1],
Blitter.COPY);
// create an Image<T> out of it
final ImagePlus maskImp = new ImagePlus("Mask", ipSlice);
// and remember it and the masks bounding box
mi.mask = ImagePlusAdapter.<T> wrap(maskImp);
}
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:44,代码来源:Coloc_2.java
示例14: produceSticksNoiseImage
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
/**
* This method creates a noise image that is made of many little
* sticks oriented in a random direction. How many of them and
* what the length of them are can be specified.
*
* @return a new noise image that is not smoothed
*/
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> produceSticksNoiseImage(int width,
int height, int numSticks, int lineWidth, double maxLength) {
/* For now (probably until ImageJ2 is out) we use an
* ImageJ image to draw lines.
*/
int options = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY;
ImagePlus img = NewImage.createByteImage("Noise", width, height, 1, options);
ImageProcessor imp = img.getProcessor();
imp.setColor(Color.WHITE);
imp.setLineWidth(lineWidth);
for (int i=0; i < numSticks; i++) {
// find random starting point
int x = (int) (Math.random() * width);
int y = (int) (Math.random() * height);
// create random stick length and direction
double length = Math.random() * maxLength;
double angle = Math.random() * 2 * Math.PI;
// calculate random point on circle, for the direction
int destX = x + (int) (length * Math.cos(angle));
int destY = y + (int) (length * Math.sin(angle));
// now draw the line
imp.drawLine(x, y, destX, destY);
}
// we changed the data, so update it
img.updateImage();
return ImagePlusAdapter.wrap(img);
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:37,代码来源:TestImageAccessor.java
示例15: wrap
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
/** Wrap an ImageJ's {@link ImagePlus} as an Imglib {@link Img} of the appropriate type.
* The data is not copied, but merely accessed with a PlanarArrayContainer.
* @see ImagePlusAdapter */
public static<T extends RealType<T> & NativeType<T>> Img<T> wrap(final ImagePlus imp) {
return ImagePlusAdapter.<T>wrap(imp);
}
开发者ID:imglib,项目名称:imglib2-script,代码行数:7,代码来源:ImgLib.java
示例16: createImagePlusImage
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
private Img<UnsignedByteType> createImagePlusImage(final ImageProcessor ip) {
final ImagePlus imp = new ImagePlus("image", ip);
return ImagePlusAdapter.wrapByte(imp);
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:5,代码来源:PerformanceBenchmark.java
示例17: main
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
public static <T extends RealType<T> & NativeType<T>> void main(final String[] args) {
ImageJ.main(args);
final File file = new File( "DrosophilaWing.tif" );
final ImagePlus imp = IJ.openImage(file.getAbsolutePath());
final Img<T> img = ImagePlusAdapter.wrap(imp);
final long start = System.currentTimeMillis();
final Shape shape = new PeriodicLineShape(2, new int[] { 20, -15 });
final Img< T > target = Erosion.erode( img, shape, 1 );
final long end = System.currentTimeMillis();
System.out.println( "Processing done in " + ( end - start ) + " ms." );
ImageJFunctions.show(img);
ImageJFunctions.show(target);
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:21,代码来源:PeriodicLineNeighborhoodTest.java
示例18: getDirectionImage
import net.imglib2.img.ImagePlusAdapter; //导入依赖的package包/类
public Img<UnsignedByteType> getDirectionImage(ImagePlus img)
{
float[][] kirsch = new float[][] { {-3,-3,5,-3,0,5,-3,-3,5},
{-3,5,5,-3,0,5,-3,-3,-3},
{5,5,5,-3,0,-3,-3,-3,-3},
{5,5,-3,5,0,-3,-3,-3,-3},
{5,-3,-3,5,0,-3,5,-3,-3},
{-3,-3,-3,5,0,-3,5,5,-3},
{-3,-3,-3,-3,0,-3,5,5,5},
{-3,-3,-3,-3,0,5,-3,5,5}};
Img<UnsignedByteType>[] responseImages = new Img[8];
for(int i = 0; i < 8; i++)
{
ImagePlus tmp = img.duplicate();
tmp.getChannelProcessor().convolve(kirsch[i],3,3);
responseImages[i] = ImagePlusAdapter.wrap(tmp);
}
Cursor c1 = responseImages[0].cursor();
Cursor c2 = responseImages[1].cursor();
Cursor c3 = responseImages[2].cursor();
Cursor c4 = responseImages[3].cursor();
Cursor c5 = responseImages[4].cursor();
Cursor c6 = responseImages[5].cursor();
Cursor c7 = responseImages[6].cursor();
Cursor c8 = responseImages[7].cursor();
long[] dim = new long[2];
responseImages[0].dimensions(dim);
//final Img< T > directionImage = imgFactory.create( responseImages[0], responseImages[0].firstElement() );
ImgFactory< UnsignedByteType > imgFactory = new ArrayImgFactory< UnsignedByteType >();
final Img<UnsignedByteType> directionImage = imgFactory.create(dim,new UnsignedByteType());
//final Img< T > directionImage = imgFactory.create(dim,new RealType());
Cursor<UnsignedByteType> cDirection = directionImage.cursor();
while (c1.hasNext())
{
RealType[] t = new RealType[8];
t[0] = (RealType)c1.next();
t[1] = (RealType)c2.next();
t[2] = (RealType)c3.next();
t[3] = (RealType)c4.next();
t[4] = (RealType)c5.next();
t[5] = (RealType)c6.next();
t[6] = (RealType)c7.next();
t[7] = (RealType)c8.next();
RealType tDirection = cDirection.next();
float max = 0f;
int kernelId = 0;
for(int i = 0; i < 8; i++)
{
float currentValue = t[i].getRealFloat();
if(i==0)
{
max = currentValue;
kernelId = 0;
}
else if(currentValue>max)
{
max = currentValue;
kernelId = i;
}
}
tDirection.setReal(kernelId);
}
return directionImage;
}
开发者ID:nicjac,项目名称:PHANTAST-FIJI,代码行数:81,代码来源:PHANTAST_.java
示例19: 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);
}
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:52,代码来源:EdgelClusteringRansac.java
示例20: 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);
}
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:59,代码来源:EdgelClustering.java
注:本文中的net.imglib2.img.ImagePlusAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论