本文整理汇总了Java中net.imglib2.exception.IncompatibleTypeException类的典型用法代码示例。如果您正苦于以下问题:Java IncompatibleTypeException类的具体用法?Java IncompatibleTypeException怎么用?Java IncompatibleTypeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IncompatibleTypeException类属于net.imglib2.exception包,在下文中一共展示了IncompatibleTypeException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: HWatershedLabeling
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
public HWatershedLabeling(Img<T> input, float threshold, Connectivity connectivity)
{
int nDims = input.numDimensions();
long[] dims = new long[nDims];
input.dimensions(dims);
ImgFactory<IntType> imgFactoryIntType=null;
try {
imgFactoryIntType = input.factory().imgFactory( new IntType() );
} catch (IncompatibleTypeException e) {
e.printStackTrace();
}
if ( imgFactoryIntType != null )
{
this.labelMapMaxTree = imgFactoryIntType.create(dims, new IntType(0));
Cursor<IntType> c_label = labelMapMaxTree.cursor();
Cursor<T> c_input = input.cursor();
while( c_input.hasNext() )
{
c_label.next().setInteger( (int) c_input.next().getRealFloat() );
}
}
this.threshold = threshold;
this.connectivity = connectivity;
}
开发者ID:mpicbg-scicomp,项目名称:Interactive-H-Watershed,代码行数:27,代码来源:HWatershedLabeling.java
示例2: RealARGBConverterBenchmark
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
public RealARGBConverterBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
// open with ImgOpener using an ArrayImgFactory
final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
argbImg = new ArrayImgFactory< ARGBType >().create( img, new ARGBType() );
BenchmarkHelper.benchmarkAndPrint( 15, true, new Runnable()
{
@Override
public void run()
{
for ( int i = 0; i < 10; ++i )
convert( img, argbImg );
}
} );
ImageJFunctions.show( argbImg );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:20,代码来源:RealARGBConverterBenchmark.java
示例3: main
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
public static <T extends RealType<T> & NativeType< T >> void main(final String[] args) throws ImgIOException, IncompatibleTypeException {
// File file = new File( "E:/Users/JeanYves/Desktop/Data/Y.tif");
final File file = new File( "/home/tobias/Desktop/Y.tif");
final int niter = 1000;
// Open file in imglib2
final ImgFactory< ? > imgFactory = new ArrayImgFactory< T >();
final Img< T > image = (Img< T >) new ImgOpener().openImg( file.getAbsolutePath(), imgFactory );
// Display it via ImgLib using ImageJ
new ImageJ();
ImageJFunctions.show( image );
benchmark( IterationMethod.TRANSLATE_VIEW, "With translated views:", niter, image );
benchmark( IterationMethod.TRANSLATE_VIEW_CURSOR, "With translated views (Cursors only):", niter, image );
benchmark( IterationMethod.TRANSLATE_VIEW_SPLIT, "With translated views (split into center and borders):", niter, image );
benchmark( IterationMethod.RANDOM_ACCESS, "With random access:", niter, image );
benchmark( IterationMethod.RANDOM_ACCESS_SPLIT, "With random access (split into center and borders):", niter, image );
benchmark( IterationMethod.RANDOM_ACCESS_NO_EXTEND, "With random access, no out of bounds access:", niter, image );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:22,代码来源:TestRelativeIterationPerformance.java
示例4: main
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
public static void main( final String[] args ) throws ImgIOException
{
final String fn = "/home/tobias/workspace/data/DrosophilaWing.tif";
final Img< FloatType > img = new ImgOpener().openImg( fn, new ArrayImgFactory< FloatType >(), new FloatType() );
final long[] dims = new long[ img.numDimensions() ];
img.dimensions( dims );
final Img< FloatType > convolved = ArrayImgs.floats( dims );
try
{
Gauss3.gauss( 3, Views.extendMirrorSingle( img ), convolved );
// Gauss3.gauss( 5, img, Views.interval( convolved, Intervals.createMinSize( 200, 100, 200, 150 ) ) );
}
catch ( final IncompatibleTypeException e )
{
e.printStackTrace();
}
ImageJFunctions.show( convolved );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:21,代码来源:Gauss3Example.java
示例5: compute
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
@Override
public void compute(final RandomAccessibleInterval<T> input,
final RandomAccessibleInterval<T> output)
{
if (outOfBounds == null) {
outOfBounds = new OutOfBoundsMirrorFactory<>(Boundary.SINGLE);
}
final RandomAccessible<FloatType> eIn = //
(RandomAccessible) Views.extend(input, outOfBounds);
try {
SeparableSymmetricConvolution.convolve(Gauss3.halfkernels(sigmas), eIn,
output, threads.getExecutorService());
}
catch (final IncompatibleTypeException e) {
throw new RuntimeException(e);
}
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:DefaultGaussRAI.java
示例6: testLocalMeanResultsConsistency
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
/**
* @see LocalMeanThresholdIntegral
* @see LocalMeanThreshold
*/
@Test
public void testLocalMeanResultsConsistency() {
Img<BitType> out2 = null;
Img<BitType> out3 = null;
try {
out2 = in.factory().imgFactory(new BitType()).create(in, new BitType());
out3 = in.factory().imgFactory(new BitType()).create(in, new BitType());
}
catch (IncompatibleTypeException exc) {
exc.printStackTrace();
}
// Default implementation
ops.run(LocalMeanThreshold.class, out2, in, new RectangleShape(2, false),
new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE),
0.0);
// Integral image-based implementation
ops.run(LocalMeanThresholdIntegral.class, out3, in, new RectangleShape(2,
false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(
Boundary.SINGLE), 0.0);
testIterableIntervalSimilarity(out2, out3);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:29,代码来源:LocalThresholdTest.java
示例7: testLocalNiblackResultsConsistency
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
/**
* @see LocalNiblackThresholdIntegral
* @see LocalNiblackThreshold
*/
@Test
public void testLocalNiblackResultsConsistency() {
Img<BitType> out2 = null;
Img<BitType> out3 = null;
try {
out2 = in.factory().imgFactory(new BitType()).create(in, new BitType());
out3 = in.factory().imgFactory(new BitType()).create(in, new BitType());
}
catch (IncompatibleTypeException exc) {
exc.printStackTrace();
}
// Default implementation
ops.run(LocalNiblackThreshold.class, out2, normalizedIn, new RectangleShape(
2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(
Boundary.SINGLE), 0.2, 1.0);
// Integral image-based implementation
ops.run(LocalNiblackThresholdIntegral.class, out3, normalizedIn,
new RectangleShape(2, false),
new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE),
0.2, 1.0);
testIterableIntervalSimilarity(out2, out3);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:30,代码来源:LocalThresholdTest.java
示例8: testLocalSauvolaResultsConsistency
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
/**
* @see LocalSauvolaThresholdIntegral
* @see LocalSauvolaThreshold
*/
@Test
public void testLocalSauvolaResultsConsistency() {
Img<BitType> out2 = null;
Img<BitType> out3 = null;
try {
out2 = in.factory().imgFactory(new BitType()).create(in, new BitType());
out3 = in.factory().imgFactory(new BitType()).create(in, new BitType());
}
catch (IncompatibleTypeException exc) {
exc.printStackTrace();
}
// Default implementation
ops.run(LocalSauvolaThreshold.class, out2, normalizedIn, new RectangleShape(
2, false), new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(
Boundary.SINGLE), 0.5, 0.5);
// Integral image-based implementation
ops.run(LocalSauvolaThresholdIntegral.class, out3, normalizedIn,
new RectangleShape(2, false),
new OutOfBoundsMirrorFactory<ByteType, Img<ByteType>>(Boundary.SINGLE),
0.5, 0.5);
testIterableIntervalSimilarity(out2, out3);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:30,代码来源:LocalThresholdTest.java
示例9: preSmooth
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
protected < T extends RealType< T > > void preSmooth( final RandomAccessibleInterval< T > img )
{
if ( additionalSigmaX > 0.0 || additionalSigmaY > 0.0 || additionalSigmaZ > 0.0 )
{
IOFunctions.println( "presmoothing image with sigma=[" + additionalSigmaX + "," + additionalSigmaY + "," + additionalSigmaZ + "]" );
try
{
Gauss3.gauss( new double[]{ additionalSigmaX, additionalSigmaY, additionalSigmaZ }, Views.extendMirrorSingle( img ), img );
}
catch (IncompatibleTypeException e)
{
IOFunctions.println( "presmoothing failed: " + e );
e.printStackTrace();
}
}
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:17,代码来源:DifferenceOf.java
示例10: openImgs
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
/**
* @param reader - An initialized {@link Reader} to use for reading image
* data.
* @param config - {@link SCIFIOConfig} to use when opening this dataset
* @return - the {@link ImgPlus} or null
* @throws ImgIOException if there is a problem reading the image data.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<SCIFIOImgPlus<?>> openImgs(final Reader reader,
SCIFIOConfig config) throws ImgIOException
{
final RealType t = getType(reader);
if (config == null) {
config = new SCIFIOConfig().imgOpenerSetComputeMinMax(true);
}
final ImgFactoryHeuristic heuristic = getHeuristic(config);
ImgFactory imgFactory;
try {
if (NativeType.class.isAssignableFrom(t.getClass())) {
imgFactory =
heuristic.createFactory(reader.getMetadata(), config
.imgOpenerGetImgModes(), (NativeType) t);
}
else return null;
}
catch (final IncompatibleTypeException e) {
throw new ImgIOException(e);
}
return openImgs(reader, t, imgFactory, config);
}
开发者ID:scifio,项目名称:scifio,代码行数:33,代码来源:ImgOpener.java
示例11: SCIFIOConfig
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
/**
* @param reader - An initialized {@link Reader} to use for reading image
* data.
* @param type - The {@link Type} T of the output {@link ImgPlus}, which must
* match the typing of the {@link ImgFactory}.
* @param config - {@link SCIFIOConfig} to use when opening this dataset
* @return - the {@link ImgPlus} or null
* @throws ImgIOException if there is a problem reading the image data.
*/
public <T extends RealType<T> & NativeType<T>> List<SCIFIOImgPlus<T>>
openImgs(final Reader reader, final T type, SCIFIOConfig config)
throws ImgIOException
{
if (config == null) {
config = new SCIFIOConfig().imgOpenerSetComputeMinMax(true);
}
final ImgFactoryHeuristic heuristic = getHeuristic(config);
ImgFactory<T> imgFactory;
try {
imgFactory =
heuristic.createFactory(reader.getMetadata(), config
.imgOpenerGetImgModes(), type);
}
catch (final IncompatibleTypeException e) {
throw new ImgIOException(e);
}
return openImgs(reader, type, imgFactory, config);
}
开发者ID:scifio,项目名称:scifio,代码行数:31,代码来源:ImgOpener.java
示例12: writeImg
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
/**
* Terminal {@link #writeImg} method. Performs actual pixel output.
*/
private Metadata writeImg(final Writer w, final SCIFIOImgPlus<?> imgPlus,
final int imageIndex, final int sliceCount) throws ImgIOException,
IncompatibleTypeException
{
if (imgPlus.numDimensions() > 0) {
final long startTime = System.currentTimeMillis();
// write pixels
writePlanes(w, imageIndex, imgPlus);
// Print time statistics
final long endTime = System.currentTimeMillis();
final float time = (endTime - startTime) / 1000f;
statusService.showStatus(sliceCount, sliceCount, w.getMetadata()
.getDatasetName() +
": wrote " + sliceCount + " planes in " + time + " s");
}
return w.getMetadata();
}
开发者ID:scifio,项目名称:scifio,代码行数:24,代码来源:ImgSaver.java
示例13: testImgPlusIntegrity
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
/**
* Write an image to memory using the {@link ImgSaver} and verify that the
* given {@link ImgPlus} is not corrupted during the process.
*/
@Test
public void testImgPlusIntegrity() throws ImgIOException,
IncompatibleTypeException
{
final ImgOpener o = new ImgOpener(ctx);
final ImgSaver s = new ImgSaver(ctx);
final SCIFIOConfig config = new SCIFIOConfig().imgOpenerSetImgModes(
ImgMode.PLANAR);
final ByteArrayHandle bah = new ByteArrayHandle();
locationService.mapFile(out, bah);
final SCIFIOImgPlus<?> openImg = o.openImgs(id, config).get(0);
final String source = openImg.getSource();
s.saveImg(out, openImg);
assertEquals(source, openImg.getSource());
}
开发者ID:scifio,项目名称:scifio,代码行数:21,代码来源:ImgSaverTest.java
示例14: testPlaneSavingForConfig
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
private void testPlaneSavingForConfig(final SCIFIOConfig config)
throws ImgIOException, IncompatibleTypeException
{
final ImgOpener o = new ImgOpener(ctx);
final ImgSaver s = new ImgSaver(ctx);
// write the image
final SCIFIOImgPlus<UnsignedByteType> before = o.openImgs(id,
new UnsignedByteType(), config).get(0);
s.saveImg(out, before);
// re-read the written image and check for consistency
final SCIFIOImgPlus<UnsignedByteType> after = o.openImgs(out,
new UnsignedByteType()).get(0);
assertImagesEqual(before, after);
}
开发者ID:scifio,项目名称:scifio,代码行数:17,代码来源:ImgSaverTest.java
示例15: doTestGenerics
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
private <T extends RealType<T> & NativeType<T>> void doTestGenerics(
final T type) throws IncompatibleTypeException, ImgIOException
{
ImgPlus<T> imgPlus = null;
final ImgFactory<T> factory = new ArrayImgFactory<T>().imgFactory(type);
// Try each rawtype openImg method
imgPlus = imgOpener.openImgs(id, type).get(0);
assertNotNull(imgPlus);
imgPlus = null;
imgPlus = imgOpener.openImgs(id, type, new SCIFIOConfig()).get(0);
assertNotNull(imgPlus);
imgPlus = null;
imgPlus = imgOpener.openImgs(id, factory, type).get(0);
assertNotNull(imgPlus);
imgPlus = null;
}
开发者ID:scifio,项目名称:scifio,代码行数:19,代码来源:ImgOpenerTest.java
示例16: initFromCurrentCell
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
private void initFromCurrentCell() {
//create an array img based copy of the labeling
Labeling<String> inputLabeling = m_currentCell.getLabeling();
long[] dims = new long[inputLabeling.numDimensions()];
inputLabeling.dimensions(dims);
NativeImgFactory<?> imgFac = (NativeImgFactory<?>) ImgFactoryTypes.getImgFactory(ImgFactoryTypes.ARRAY_IMG_FACTORY);
NativeImgLabeling<String, IntType> copiedLabeling;
try {
copiedLabeling = new NativeImgLabeling<String, IntType>(imgFac.imgFactory(new IntType())
.create(dims, new IntType()));
ImgCopyOperation<LabelingType<String>> copy = new ImgCopyOperation<LabelingType<String>>();
copy.compute(inputLabeling, copiedLabeling);
//and set the current labeling
m_currentLabeling = copiedLabeling;
} catch (IncompatibleTypeException e) {
e.printStackTrace();
}
}
开发者ID:MichaelZinsmaier,项目名称:knip-contribution,代码行数:23,代码来源:LabelAnnotatorView.java
示例17: calculatePCM
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
public static <T extends ComplexType<T> & NativeType<T>, S extends ComplexType<S> & NativeType <S>, R extends RealType<R>> RandomAccessibleInterval<R> calculatePCM(
RandomAccessibleInterval<T> fft1, RandomAccessibleInterval<S> fft2, ImgFactory<R> factory, R type, ExecutorService service){
long[] paddedDimensions = new long[fft1.numDimensions()];
long[] realSize = new long[fft1.numDimensions()];
FFTMethods.dimensionsComplexToRealFast(fft1, paddedDimensions, realSize);
RandomAccessibleInterval<R> res = factory.create(realSize, type);
final T typeT = Views.iterable(fft1).firstElement().createVariable();
final S typeS = Views.iterable(fft2).firstElement().createVariable();
RandomAccessibleInterval< T > fft1Copy;
RandomAccessibleInterval< S > fft2Copy;
try
{
fft1Copy = factory.imgFactory( typeT ).create(fft1, typeT );
fft2Copy = factory.imgFactory( typeS ).create(fft2, typeS );
}
catch ( IncompatibleTypeException e )
{
throw new RuntimeException( "Cannot instantiate Img for type " + typeS.getClass().getSimpleName() + " or " + typeT.getClass().getSimpleName() );
}
calculatePCM(fft1, fft1Copy, fft2, fft2Copy, res, service);
return res;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:30,代码来源:PhaseCorrelation2.java
示例18: factory
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
@Override
public ImgFactory<T> factory() {
try {
return source.factory().imgFactory(type.createVariable());
} catch (final IncompatibleTypeException e) {
e.printStackTrace();
}
return null;
}
开发者ID:imglib,项目名称:imglib2-script,代码行数:10,代码来源:ConverterImgProxy.java
示例19: CompositeXYProjectorBenchmark
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
public CompositeXYProjectorBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
// open with ImgOpener using an ArrayImgFactory
final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
final long[] dim = new long[ img.numDimensions() - 1 ];
for ( int d = 0; d < dim.length; ++d )
dim[ d ] = img.dimension( d );
argbImg = new ArrayImgFactory< ARGBType >().create( dim, new ARGBType() );
convert( img, argbImg );
ImageJFunctions.show( argbImg );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:14,代码来源:CompositeXYProjectorBenchmark.java
示例20: RandomAccessibleProjector2DBenchmark
import net.imglib2.exception.IncompatibleTypeException; //导入依赖的package包/类
public RandomAccessibleProjector2DBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
// open with ImgOpener using an ArrayImgFactory
final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
argbImg = new ArrayImgFactory< ARGBType >().create( img, new ARGBType() );
convert( img, argbImg );
ImageJFunctions.show( argbImg );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:11,代码来源:RandomAccessibleProjector2DBenchmark.java
注:本文中的net.imglib2.exception.IncompatibleTypeException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论