本文整理汇总了Java中net.imglib2.Dimensions类的典型用法代码示例。如果您正苦于以下问题:Java Dimensions类的具体用法?Java Dimensions怎么用?Java Dimensions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dimensions类属于net.imglib2包,在下文中一共展示了Dimensions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:17,代码来源:StitchingUIHelper.java
示例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;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:26,代码来源:PhaseCorrelation2.java
示例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);
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:23,代码来源:PhaseCorrelationPeak2.java
示例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 );
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:30,代码来源:H5Utils.java
示例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 );
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:28,代码来源:H5Utils.java
示例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 );
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:27,代码来源:H5Utils.java
示例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;
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:20,代码来源:LabelingExample.java
示例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]);
}
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:22,代码来源:FrangiVesselness.java
示例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;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:DeconvolveNamespace.java
示例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());
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:AbstractIntegralImg.java
示例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);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:24,代码来源:FFTMethodsOpF.java
示例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;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:DefaultComputeFFTSize.java
示例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);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:CreateImgTest.java
示例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());
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:CreateLabelingTest.java
示例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;
}
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:23,代码来源:ExportSpimFusionPlugIn.java
示例16: FusionResult
import net.imglib2.Dimensions; //导入依赖的package包/类
public FusionResult(
final String filepath,
final String filepattern,
final TimePoints timepoints,
final int numSlices,
final double sliceValueMin,
final double sliceValueMax,
final Map< Integer, AffineTransform3D > perTimePointFusionTransforms )
{
final HashMap< Integer, Integer > setupIdToChannelId = new HashMap<>();
setupIdToChannelId.put( 0, 0 );
final ImgLoader fusionLoader = new FusionImageLoader<>( filepath +"/" + filepattern, setupIdToChannelId, numSlices, new FusionImageLoader.Gray32ImagePlusLoader(), sliceValueMin, sliceValueMax );
final int setupId = 0;
final String name = "fused";
final int timepointId = timepoints.getTimePointsOrdered().get( 0 ).getId();
final Dimensions size = fusionLoader.getSetupImgLoader( setupId ).getImageSize( timepointId );
final VoxelDimensions voxelSize = fusionLoader.getSetupImgLoader( setupId ).getVoxelSize( timepointId );
final BasicViewSetup setup = new BasicViewSetup( setupId, name, size, voxelSize );
desc = new SequenceDescriptionMinimal( timepoints, Entity.idMap( Arrays.asList( setup ) ), fusionLoader, null );
final ArrayList< ViewRegistration > registrations = new ArrayList<>();
for ( final TimePoint timepoint : timepoints.getTimePointsOrdered() )
registrations.add( new ViewRegistration( timepoint.getId(), 0, perTimePointFusionTransforms.get( timepoint.getId() ) ) );
regs = new ViewRegistrations( registrations );
}
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:25,代码来源:FusionResult.java
示例17: getImage
import net.imglib2.Dimensions; //导入依赖的package包/类
@Override
public RandomAccessibleInterval< UnsignedShortType > getImage( final int timepointId, final ImgLoaderHint... hints )
{
final Dimensions dimensions = getImageSize( timepointId );
final Img< UnsignedShortType > img = factory.create( dimensions, type );
for ( int z = 0; z < numSlices; ++z )
{
final RandomAccessibleInterval< T > slice = sliceLoader.load( String.format( pattern, timepointId, channelId, z ) );
final Cursor< UnsignedShortType > d = Views.flatIterable( Views.hyperSlice( img, 2, z ) ).cursor();
for ( final UnsignedShortType t : Converters.convert( Views.flatIterable( slice ), converter, type ) )
d.next().set( t );
}
return img;
}
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:17,代码来源:FusionImageLoader.java
示例18: createViewSetups
import net.imglib2.Dimensions; //导入依赖的package包/类
/**
* Creates the List of {@link ViewSetup} for the {@link SpimData} object.
* The {@link ViewSetup} are defined independent of the {@link TimePoint},
* each {@link TimePoint} should have the same {@link ViewSetup}s. The {@link MissingViews}
* class defines if some of them are missing for some of the {@link TimePoint}s
*
* @return
*/
protected ArrayList< ViewSetup > createViewSetups( final DHMMetaData meta )
{
final ArrayList< Channel > channels = new ArrayList< Channel >();
channels.add( new Channel( meta.getAmpChannelId(), meta.getAmplitudeDir() ) );
channels.add( new Channel( meta.getPhaseChannelId(), meta.getPhaseDir() ) );
final ArrayList< Illumination > illuminations = new ArrayList< Illumination >();
illuminations.add( new Illumination( 0, String.valueOf( 0 ) ) );
final ArrayList< Angle > angles = new ArrayList< Angle >();
angles.add( new Angle( 0, String.valueOf( 0 ) ) );
final ArrayList< ViewSetup > viewSetups = new ArrayList< ViewSetup >();
for ( final Channel c : channels )
for ( final Illumination i : illuminations )
for ( final Angle a : angles )
{
final VoxelDimensions voxelSize = new FinalVoxelDimensions( meta.calUnit, meta.calX, meta.calY, meta.calZ );
final Dimensions dim = new FinalDimensions( new long[]{ meta.getWidth(), meta.getHeight(), meta.getDepth() } );
viewSetups.add( new ViewSetup( viewSetups.size(), null, dim, voxelSize, c, a, i ) );
}
return viewSetups;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:33,代码来源:DHM.java
示例19: updateXMLMetaData
import net.imglib2.Dimensions; //导入依赖的package包/类
/**
* Updates one specific ViewSetup using the imageMetaDataCache
*
* @param setup - {@link ViewSetup}s that can potentially be updated if it is in the cache
* @param forceUpdate - overwrite the data if it is already present
* @return true if something was updated, false if it was not in the cache or if could have been updated but was already there
*/
public boolean updateXMLMetaData( final ViewSetup setup, final boolean forceUpdate )
{
boolean updated = false;
if ( viewIdLookUp.containsKey( setup.getId() ) )
{
// look up the metadata using the ViewId linked by the ViewSetupId
final Pair< Dimensions, VoxelDimensions > metaData = imageMetaDataCache.get( viewIdLookUp.get( setup.getId() ) );
if ( !setup.hasSize() || forceUpdate )
{
setup.setSize( metaData.getA() );
updated = true;
}
if ( !setup.hasVoxelSize() || forceUpdate )
{
setup.setVoxelSize( metaData.getB() );
updated = true;
}
}
return updated;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:32,代码来源:AbstractImgLoader.java
示例20: getImage
import net.imglib2.Dimensions; //导入依赖的package包/类
@Override
public RandomAccessibleInterval< UnsignedShortType > getImage( final ViewId view )
{
final BasicViewDescription< ? > vd = sd.getViewDescriptions().get( view );
final Dimensions d = vd.getViewSetup().getSize();
final VoxelDimensions dv = vd.getViewSetup().getVoxelSize();
final ArrayImg< UnsignedShortType, ? > img = ArrayImgs.unsignedShorts( d.dimension( 0 ), d.dimension( 1 ), d.dimension( 2 ) );
final String ampOrPhaseDir;
if ( vd.getViewSetup().getAttribute( Channel.class ).getId() == ampChannelId )
ampOrPhaseDir = amplitudeDir;
else if ( vd.getViewSetup().getAttribute( Channel.class ).getId() == phaseChannelId )
ampOrPhaseDir = phaseDir;
else
throw new RuntimeException( "viewSetupId=" + view.getViewSetupId() + " is not Amplitude nor phase." );
populateImage( img, directory, stackDir, ampOrPhaseDir, zPlanes, timepoints.get( view.getTimePointId() ), extension );
updateMetaDataCache( view, (int)d.dimension( 0 ), (int)d.dimension( 1 ), (int)d.dimension( 2 ), dv.dimension( 0 ), dv.dimension( 1 ), dv.dimension( 2 ) );
return img;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:25,代码来源:LegacyDHMImgLoader.java
注:本文中的net.imglib2.Dimensions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论