本文整理汇总了Java中mpicbg.spim.data.sequence.VoxelDimensions类的典型用法代码示例。如果您正苦于以下问题:Java VoxelDimensions类的具体用法?Java VoxelDimensions怎么用?Java VoxelDimensions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VoxelDimensions类属于mpicbg.spim.data.sequence包,在下文中一共展示了VoxelDimensions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateProposedMipmaps
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的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;
}
示例2: FusionResult
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的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 );
}
示例3: setModelToCalibration
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
public static void setModelToCalibration( final SpimData spimData, final ViewId viewId, final double minResolution )
{
setModelToIdentity( spimData, viewId );
final ViewRegistrations viewRegistrations = spimData.getViewRegistrations();
final ViewRegistration r = viewRegistrations.getViewRegistration( viewId );
final ViewDescription viewDescription = spimData.getSequenceDescription().getViewDescription(
viewId.getTimePointId(), viewId.getViewSetupId() );
VoxelDimensions voxelSize = ViewSetupUtils.getVoxelSizeOrLoad( viewDescription.getViewSetup(), viewDescription.getTimePoint(), spimData.getSequenceDescription().getImgLoader() );
final double calX = voxelSize.dimension( 0 ) / minResolution;
final double calY = voxelSize.dimension( 1 ) / minResolution;
final double calZ = voxelSize.dimension( 2 ) / minResolution;
final AffineTransform3D m = new AffineTransform3D();
m.set( calX, 0.0f, 0.0f, 0.0f,
0.0f, calY, 0.0f, 0.0f,
0.0f, 0.0f, calZ, 0.0f );
final ViewTransform vt = new ViewTransformAffine( "calibration", m );
r.preconcatenateTransform( vt );
}
示例4: createViewSetups
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的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;
}
示例5: updateXMLMetaData
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的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;
}
示例6: getImage
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的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;
}
示例7: getBlending
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
protected Blending getBlending( final Interval interval, final ViewDescription desc, final ImgLoader imgLoader )
{
final float[] blending = ProcessFusion.defaultBlendingRange.clone();
final float[] border = ProcessFusion.defaultBlendingBorder.clone();
final float minRes = (float)getMinRes( desc, imgLoader );
final VoxelDimensions voxelSize = ViewSetupUtils.getVoxelSizeOrLoad( desc.getViewSetup(), desc.getTimePoint(), imgLoader );
if ( ProcessFusion.defaultAdjustBlendingForAnisotropy )
{
for ( int d = 0; d < 2; ++d )
{
blending[ d ] /= ( float ) voxelSize.dimension( d ) / minRes;
border[ d ] /= ( float ) voxelSize.dimension( d ) / minRes;
}
}
return new Blending( interval, border, blending );
}
示例8: getContentBased
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
protected < T extends RealType< T > > ContentBased< T > getContentBased( final RandomAccessibleInterval< T > img, final ViewDescription desc, final ImgLoader imgLoader )
{
final double[] sigma1 = ProcessFusion.defaultContentBasedSigma1.clone();
final double[] sigma2 = ProcessFusion.defaultContentBasedSigma2.clone();
final double minRes = getMinRes( desc, imgLoader );
final VoxelDimensions voxelSize = ViewSetupUtils.getVoxelSizeOrLoad( desc.getViewSetup(), desc.getTimePoint(), imgLoader );
if ( ProcessFusion.defaultAdjustContentBasedSigmaForAnisotropy )
{
for ( int d = 0; d < 2; ++d )
{
sigma1[ d ] /= voxelSize.dimension( d ) / minRes;
sigma2[ d ] /= voxelSize.dimension( d ) / minRes;
}
}
return new ContentBased<T>( img, bb.getImgFactory( new ComplexFloatType() ), sigma1, sigma2);
}
示例9: createSetups
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
public static ArrayList< ViewSetup > createSetups()
{
final ArrayList< ViewSetup > setups = new ArrayList< ViewSetup >();
final Channel c0 = new Channel( 0 );
final Angle a0 = new Angle( 0, "0", 240, new double[] {1, 0, 0} );
final Angle a1 = new Angle( 1, "120", 120, new double[] {1, 0, 0} );
final Angle a2 = new Angle( 2, "240" );
final Illumination i0 = new Illumination( 0 );
final Tile t0 = new Tile( 0, "Tile0", new double[]{ 0.0, 0.0, 0.0 } );
final Dimensions d0 = new FinalDimensions( 1000l, 1000l, 300l );
final VoxelDimensions vd0 = new FinalVoxelDimensions( "px", 1, 1, 1 );
setups.add( new ViewSetup( 0, "setup 0", d0, vd0, t0, c0, a0, i0 ) );
setups.add( new ViewSetup( 1, "setup 1", d0, vd0, t0, c0, a1, i0 ) );
setups.add( new ViewSetup( 2, "setup 2", null, null, t0, c0, a2, i0 ) );
return setups;
}
示例10: downsampleFactor
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
public int downsampleFactor( final int downsampleXY, final int downsampleZ, final VoxelDimensions v )
{
final double calXY = Math.min( v.dimension( 0 ), v.dimension( 1 ) );
final double calZ = v.dimension( 2 ) * downsampleZ;
final double log2ratio = Math.log( calZ / calXY ) / Math.log( 2 );
final double exp2;
if ( downsampleXY == 0 )
exp2 = Math.pow( 2, Math.floor( log2ratio ) );
else
exp2 = Math.pow( 2, Math.ceil( log2ratio ) );
return (int)Math.round( exp2 );
}
示例11: createViewRegistrations
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
/**
* Assembles the {@link ViewRegistration} object consisting of a list of {@link ViewRegistration}s for all {@link ViewDescription}s that are present
*
* @param viewDescriptionList
* @param minResolution - the smallest resolution in any dimension (distance between two pixels in the output image will be that wide)
* @return
*/
protected static ViewRegistrations createViewRegistrations( final Map< ViewId, ViewDescription > viewDescriptionList, final double minResolution )
{
final HashMap< ViewId, ViewRegistration > viewRegistrationList = new HashMap< ViewId, ViewRegistration >();
for ( final ViewDescription viewDescription : viewDescriptionList.values() )
if ( viewDescription.isPresent() )
{
final ViewRegistration viewRegistration = new ViewRegistration( viewDescription.getTimePointId(), viewDescription.getViewSetupId() );
final VoxelDimensions voxelSize = viewDescription.getViewSetup().getVoxelSize();
final double calX = voxelSize.dimension( 0 ) / minResolution;
final double calY = voxelSize.dimension( 1 ) / minResolution;
final double calZ = voxelSize.dimension( 2 ) / minResolution;
final AffineTransform3D m = new AffineTransform3D();
m.set( calX, 0.0f, 0.0f, 0.0f,
0.0f, calY, 0.0f, 0.0f,
0.0f, 0.0f, calZ, 0.0f );
final ViewTransform vt = new ViewTransformAffine( "calibration", m );
viewRegistration.preconcatenateTransform( vt );
viewRegistrationList.put( viewRegistration, viewRegistration );
}
return new ViewRegistrations( viewRegistrationList );
}
示例12: getVoxelSize
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
/**
* @param setup - the {@link BasicViewSetup}
* @return - the Voxelsize for this {@link ViewSetup} or null if it is not in the XML
*/
public static VoxelDimensions getVoxelSize( final BasicViewSetup setup )
{
if ( setup.hasVoxelSize() )
return setup.getVoxelSize();
else
return null;
}
示例13: getVoxelSizeOrLoad
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
/**
* @param setup - the {@link BasicViewSetup} for which to get the Voxelsize
* @param t - the {@link TimePoint} from which to load the Voxelsize
* @param loader - the {@link ImgLoader}
* @return - the Voxelsize for this {@link ViewSetup}
*/
public static VoxelDimensions getVoxelSizeOrLoad( final BasicViewSetup setup, final TimePoint t, final ImgLoader loader )
{
if ( setup.hasVoxelSize() )
return setup.getVoxelSize();
else
return loader.getSetupImgLoader( setup.getId() ).getVoxelSize( t.getId() );
}
示例14: updateMetaDataCache
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
/**
* Updates the cached imageMetaData
*/
protected void updateMetaDataCache( final ViewId viewId,
final int w, final int h, final int d,
final double calX, final double calY, final double calZ )
{
imageMetaDataCache.put( viewId, new ValuePair< Dimensions, VoxelDimensions >(
new FinalDimensions( new long[] { w, h, d } ),
new FinalVoxelDimensions( "", calX, calY, calZ ) ) );
// links the viewSetupId to the last added viewId, overwrites earlier entries
viewIdLookUp.put( viewId.getViewSetupId(), viewId );
}
示例15: getVoxelSize
import mpicbg.spim.data.sequence.VoxelDimensions; //导入依赖的package包/类
@Override
public VoxelDimensions getVoxelSize( final ViewId view )
{
// if there is no data for the viewId
if ( !imageMetaDataCache.containsKey( view ) )
{
// check if the data is present for the same viewsetup of another timepoint
if ( !viewIdLookUp.containsKey( view.getViewSetupId() ) )
loadMetaData( view );
else
return imageMetaDataCache.get( viewIdLookUp.get( view.getViewSetupId() ) ).getB();
}
return imageMetaDataCache.get( view ).getB();
}