本文整理汇总了Java中net.imglib2.Dimensions类的典型用法代码示例。如果您正苦于以下问题:Java Dimensions类的具体用法?Java Dimensions怎么用?Java Dimensions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dimensions类属于net.imglib2包,在下文中一共展示了Dimensions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allViews2D
import net.imglib2.Dimensions; //导入依赖的package包/类
public static boolean allViews2D(final List< ? extends BasicViewDescription< ? > > views)
{
List< BasicViewDescription< ? > > all3DVds = views.stream().filter( vd -> {
if (!vd.getViewSetup().hasSize())
return true;
Dimensions dims = vd.getViewSetup().getSize();
boolean all3D = true;
for (int d = 0; d<dims.numDimensions(); d++)
if (dims.dimension( d ) == 1)
all3D = false;
return all3D;
}).collect( Collectors.toList() );
boolean is2d = all3DVds.size() == 0;
return is2d;
}
示例2: calculatePCM
import net.imglib2.Dimensions; //导入依赖的package包/类
public static <T extends RealType<T>, S extends RealType<S>, R extends RealType<R>, C extends ComplexType<C>> RandomAccessibleInterval<R> calculatePCM(
RandomAccessibleInterval<T> img1, RandomAccessibleInterval<S> img2, int[] extension,
ImgFactory<R> factory, R type, ImgFactory<C> fftFactory, C fftType, ExecutorService service){
// TODO: Extension absolute per dimension in pixels, i.e. int[] extension
// TODO: not bigger than the image dimension because the second mirroring is identical to the image
Dimensions extSize = PhaseCorrelation2Util.getExtendedSize(img1, img2, extension);
long[] paddedDimensions = new long[extSize.numDimensions()];
long[] fftSize = new long[extSize.numDimensions()];
FFTMethods.dimensionsRealToComplexFast(extSize, paddedDimensions, fftSize);
RandomAccessibleInterval<C> fft1 = fftFactory.create(fftSize, fftType);
RandomAccessibleInterval<C> fft2 = fftFactory.create(fftSize, fftType);
FFT.realToComplex(Views.interval(PhaseCorrelation2Util.extendImageByFactor(img1, extension),
FFTMethods.paddingIntervalCentered(img1, new FinalInterval(paddedDimensions))), fft1, service);
FFT.realToComplex(Views.interval(PhaseCorrelation2Util.extendImageByFactor(img2, extension),
FFTMethods.paddingIntervalCentered(img2, new FinalInterval(paddedDimensions))), fft2, service);
RandomAccessibleInterval<R> pcm = calculatePCMInPlace(fft1, fft2, factory, type, service);
return pcm;
}
示例3: main
import net.imglib2.Dimensions; //导入依赖的package包/类
public static void main(String[] args) {
double o1 = 6;
double o2 = Double.NEGATIVE_INFINITY;
int np1 = 30;
int np2 = 20;
System.out.println( Double.isInfinite( o2 ));
int ccCompare = Double.compare(o1, o2);
if (ccCompare != 0)
System.out.println( ccCompare );
else
System.out.println( (int)(np1 - np2) );
System.exit( 0 );
PhaseCorrelationPeak2 peaks = new PhaseCorrelationPeak2(new Point(new int[] {10, 10}), 1.0);
Dimensions pcmDims = new FinalDimensions(new int[] {50, 50});
Dimensions imgDims = new FinalDimensions(new int[] {30, 30});
PhaseCorrelation2Util.expandPeakToPossibleShifts(peaks, pcmDims, imgDims, imgDims);
}
示例4: createUnsignedByte
import net.imglib2.Dimensions; //导入依赖的package包/类
/**
* Save a {@link RandomAccessibleInterval} of {@link LongType} into an HDF5
* uint8 dataset.
*
* @param source source
* @param dimensions dimensions of the dataset if created new
* @param writer
* @param dataset
* @param cellDimensions
*/
static public void createUnsignedByte(
final IHDF5Writer writer,
final String dataset,
final Dimensions datasetDimensions,
final int[] cellDimensions )
{
final IHDF5ByteWriter uint8Writer = writer.uint8();
if ( writer.exists( dataset ) )
writer.delete( dataset );
uint8Writer.createMDArray(
dataset,
reorder( Intervals.dimensionsAsLongArray( datasetDimensions ) ),
reorder( cellDimensions ),
HDF5IntStorageFeatures.INT_AUTO_SCALING_DEFLATE );
}
示例5: createUnsignedLong
import net.imglib2.Dimensions; //导入依赖的package包/类
/**
* Save a {@link RandomAccessibleInterval} of {@link LongType} into an HDF5
* uint64 dataset.
*
* @param source source
* @param dimensions dimensions of the dataset if created new
* @param writer
* @param dataset
* @param cellDimensions
*/
static public void createUnsignedLong(
final IHDF5Writer writer,
final String dataset,
final Dimensions datasetDimensions,
final int[] cellDimensions )
{
final IHDF5LongWriter uint64Writer = writer.uint64();
if ( writer.exists( dataset ) )
writer.delete( dataset );
uint64Writer.createMDArray(
dataset,
reorder( Intervals.dimensionsAsLongArray( datasetDimensions ) ),
reorder( cellDimensions ),
HDF5IntStorageFeatures.INT_AUTO_SCALING_DEFLATE );
}
示例6: createLong
import net.imglib2.Dimensions; //导入依赖的package包/类
/**
* Create anHDF5 int64 dataset.
*
* @param source source
* @param dimensions dimensions of the dataset if created new
* @param writer
* @param dataset
* @param cellDimensions
*/
static public void createLong(
final IHDF5Writer writer,
final String dataset,
final Dimensions datasetDimensions,
final int[] cellDimensions )
{
final IHDF5LongWriter int64Writer = writer.int64();
if ( writer.exists( dataset ) )
writer.delete( dataset );
int64Writer.createMDArray(
dataset,
reorder( Intervals.dimensionsAsLongArray( datasetDimensions ) ),
reorder( cellDimensions ),
HDF5IntStorageFeatures.INT_AUTO_SCALING_DEFLATE );
}
示例7: getIntIntImgLabellingFromLabelMapImagePlus
import net.imglib2.Dimensions; //导入依赖的package包/类
public static ImgLabeling< Integer, IntType > getIntIntImgLabellingFromLabelMapImagePlus( final ImagePlus labelMap )
{
final Img< FloatType > img2 = ImageJFunctions.convertFloat( labelMap );
final Dimensions dims = img2;
final IntType t = new IntType();
final RandomAccessibleInterval< IntType > img = Util.getArrayOrCellImgFactory( dims, t ).create( dims, t );
final ImgLabeling< Integer, IntType > labeling = new ImgLabeling<>( img );
final Cursor< LabelingType< Integer > > labelCursor = Views.flatIterable( labeling ).cursor();
for ( final UnsignedByteType input : Views.flatIterable( ImageJFunctions.wrapByte( labelMap ) ) )
{
final LabelingType< Integer > element = labelCursor.next();
if ( input.get() != 0 )
element.add( input.get() );
}
return labeling;
}
示例8: run
import net.imglib2.Dimensions; //导入依赖的package包/类
@Override
public void run() {
// parse the spacing, and scales strings.
spacing = checkDimensions(spacingString, input.numDimensions(), "Spacings");
scales = Arrays.stream(scaleString.split(regex)).mapToInt(Integer::parseInt)
.toArray();
Dimensions resultDims = Views.addDimension(input, 0, scales.length - 1);
// create output image, potentially-filtered input
result = opService.create().img(resultDims, new FloatType());
for (int s = 0; s < scales.length; s++) {
// Determine whether or not the user would like to apply the gaussian
// beforehand and do it.
RandomAccessibleInterval<T> vesselnessInput = doGauss ? opService.filter()
.gauss(input, scales[s]) : input;
IntervalView<FloatType> scaleResult = Views.hyperSlice(result, result
.numDimensions() - 1, s);
opService.filter().frangiVesselness(scaleResult, vesselnessInput, spacing,
scales[s]);
}
}
示例9: ops
import net.imglib2.Dimensions; //导入依赖的package包/类
@OpMethod(
op = net.imagej.ops.deconvolve.NonCirculantNormalizationFactor.class)
public <O extends RealType<O>> RandomAccessibleInterval<O>
normalizationFactor(final RandomAccessibleInterval<O> arg,
final Dimensions k, final Dimensions l,
final RandomAccessibleInterval<O> fftInput,
final RandomAccessibleInterval<O> fftKernel,
final Interval imgConvolutionInterval)
{
@SuppressWarnings("unchecked")
final RandomAccessibleInterval<O> result =
(RandomAccessibleInterval<O>) ops().run(
net.imagej.ops.deconvolve.NonCirculantNormalizationFactor.class, arg, k,
l, fftInput, fftKernel, imgConvolutionInterval);
return result;
}
示例10: initialize
import net.imglib2.Dimensions; //导入依赖的package包/类
@Override
public void initialize() {
if (in() != null) {
slicewiseOps = new UnaryComputerOp[in().numDimensions()];
for (int i = 0; i < in().numDimensions(); ++i) {
slicewiseOps[i] = Computers.unary(ops(), Slice.class,
RandomAccessibleInterval.class, RandomAccessibleInterval.class,
getComputer(i), i);
}
}
createLongRAI = Functions.unary(ops(), Ops.Create.Img.class,
RandomAccessibleInterval.class, Dimensions.class, new LongType());
createDoubleRAI = Functions.unary(ops(), Ops.Create.Img.class,
RandomAccessibleInterval.class, Dimensions.class, new DoubleType());
}
示例11: initialize
import net.imglib2.Dimensions; //导入依赖的package包/类
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void initialize() {
super.initialize();
// if no type was passed in the default is ComplexFloatType
if (fftType == null) {
fftType = (C)ops().create().nativeType(ComplexFloatType.class);
}
padOp = (BinaryFunctionOp) Functions.binary(ops(), PadInputFFTMethods.class,
RandomAccessibleInterval.class, RandomAccessibleInterval.class,
Dimensions.class, fast);
createOp = (UnaryFunctionOp) Functions.unary(ops(),
CreateOutputFFTMethods.class, RandomAccessibleInterval.class,
Dimensions.class, fftType, fast);
fftMethodsOp = (UnaryComputerOp) Computers.nullary(ops(),
FFTMethodsOpC.class, RandomAccessibleInterval.class,
RandomAccessibleInterval.class);
}
示例12: calculate
import net.imglib2.Dimensions; //导入依赖的package包/类
@Override
public long[][] calculate(Dimensions inputDimensions) {
long[][] size = new long[2][];
size[0] = new long[inputDimensions.numDimensions()];
size[1] = new long[inputDimensions.numDimensions()];
for (int i = 0; i < inputDimensions.numDimensions(); i++) {
// real size
if (powerOfTwo) {
size[0][i] = NextPowerOfTwo.nextPowerOfTwo(inputDimensions.dimension(i));
} else {
size[0][i] = (long) NextSmoothNumber.nextSmooth((int) inputDimensions.dimension(i));
}
// complex size
if (i == 0) {
size[1][i] = (size[0][i] / 2 + 1);
} else {
size[1][i] = size[0][i];
}
}
return size;
}
示例13: testImageFactory
import net.imglib2.Dimensions; //导入依赖的package包/类
@Test
public void testImageFactory() {
final Dimensions dim = new FinalDimensions(10, 10, 10);
@SuppressWarnings("unchecked")
final Img<DoubleType> arrayImg = (Img<DoubleType>) ops.run(
CreateImgFromDimsAndType.class, dim, new DoubleType(),
new ArrayImgFactory<DoubleType>());
final Class<?> arrayFactoryClass = arrayImg.factory().getClass();
assertEquals("Image Factory: ", ArrayImgFactory.class, arrayFactoryClass);
@SuppressWarnings("unchecked")
final Img<DoubleType> cellImg = (Img<DoubleType>) ops.run(
CreateImgFromDimsAndType.class, dim, new DoubleType(),
new CellImgFactory<DoubleType>());
final Class<?> cellFactoryClass = cellImg.factory().getClass();
assertEquals("Image Factory: ", CellImgFactory.class, cellFactoryClass);
}
示例14: testImageFactory
import net.imglib2.Dimensions; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testImageFactory() {
final Dimensions dim = new FinalDimensions( 10, 10, 10 );
assertEquals("Labeling Factory: ", ArrayImgFactory.class,
((Img<?>) ((ImgLabeling<String, ?>) ops.run(
DefaultCreateImgLabeling.class, dim, null,
new ArrayImgFactory<IntType>())).getIndexImg()).factory().getClass());
assertEquals("Labeling Factory: ", CellImgFactory.class,
((Img<?>) ((ImgLabeling<String, ?>) ops.run(
DefaultCreateImgLabeling.class, dim, null,
new CellImgFactory<IntType>())).getIndexImg()).factory().getClass());
}
示例15: updateProposedMipmaps
import net.imglib2.Dimensions; //导入依赖的package包/类
protected boolean updateProposedMipmaps( final String fusionDirectory, final SPIMConfiguration conf )
{
final Pair< String, Integer > pair = detectPatternAndNumSlices( new File ( fusionDirectory ), conf.timepoints[0] );
if ( pair != null )
{
final String filenamePattern = pair.getA();
final int numSlices = pair.getB();
final String fn = fusionDirectory + "/" + String.format( filenamePattern, conf.timepoints[0], conf.channels[0], 0 );
final ImagePlus imp = new ImagePlus( fn );
final int width = imp.getWidth();
final int height = imp.getHeight();
imp.close();
final Dimensions size = new FinalDimensions( new int[] { width, height, numSlices } );
final VoxelDimensions voxelSize = new FinalVoxelDimensions( "px", 1, 1, 1 );
final ExportMipmapInfo info = ProposeMipmaps.proposeMipmaps( new BasicViewSetup( 0, "", size, voxelSize ) );
autoSubsampling = ProposeMipmaps.getArrayString( info.getExportResolutions() );
autoChunkSizes = ProposeMipmaps.getArrayString( info.getSubdivisions() );
return true;
}
else
return false;
}