本文整理汇总了Java中mpicbg.spim.data.sequence.FinalVoxelDimensions类的典型用法代码示例。如果您正苦于以下问题:Java FinalVoxelDimensions类的具体用法?Java FinalVoxelDimensions怎么用?Java FinalVoxelDimensions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FinalVoxelDimensions类属于mpicbg.spim.data.sequence包,在下文中一共展示了FinalVoxelDimensions类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateProposedMipmaps
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的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: applyCal
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的package包/类
public static void applyCal( final Cal maxCal, final SpimData spimData, final List< ViewId > viewIds )
{
// this is the same for all timepoints, we are just interested in the ViewSetup
final TimePoint t = spimData.getSequenceDescription().getTimePoints().getTimePointsOrdered().get( 0 );
for ( final ViewId viewId : viewIds )
{
if ( viewId.getTimePointId() != t.getId() )
continue;
final ViewDescription desc = spimData.getSequenceDescription().getViewDescriptions().get( viewId );
final ViewSetup viewSetup = desc.getViewSetup();
viewSetup.setVoxelSize( new FinalVoxelDimensions( maxCal.unit(),
maxCal.getCal()[ 0 ],
maxCal.getCal()[ 1 ],
maxCal.getCal()[ 2 ] ) );
}
}
示例3: createViewSetups
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的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;
}
示例4: createSetups
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的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;
}
示例5: updateMetaDataCache
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的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 );
}
示例6: getVoxelDimensions
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的package包/类
protected static VoxelDimensions getVoxelDimensions( final Element parent, final String name )
{
final Element elem = parent.getChild( name );
final String unit = XmlHelpers.getText( elem, VOXELDIMENSIONS_UNIT_TAG );
final double[] size = XmlHelpers.getDoubleArray( elem, VOXELDIMENSIONS_SIZE_TAG );
return new FinalVoxelDimensions( unit, size );
}
示例7: twoAngles
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的package包/类
public static SpimData twoAngles()
{
final ArrayList< ViewSetup > setups = new ArrayList< ViewSetup >();
final ArrayList< ViewRegistration > registrations = new ArrayList< ViewRegistration >();
final Channel c0 = new Channel( 0, "test" );
final Angle a0 = new Angle( 0 );
final Angle a1 = new Angle( 1 );
final Illumination i0 = new Illumination( 0 );
final Dimensions d0 = new FinalDimensions( 512l, 512l, 86l );
final VoxelDimensions vd0 = new FinalVoxelDimensions( "px", 0.4566360, 0.4566360, 2.0000000 );
setups.add( new ViewSetup( 0, "setup 0", d0, vd0, c0, a0, i0 ) );
setups.add( new ViewSetup( 1, "setup 1", d0, vd0, c0, a1, i0 ) );
final ArrayList< TimePoint > t = new ArrayList< TimePoint >();
t.add( new TimePoint( 0 ) );
final TimePoints timepoints = new TimePoints( t );
final ArrayList< ViewId > missing = new ArrayList< ViewId >();
final MissingViews missingViews = new MissingViews( missing );
final ImgLoader imgLoader = new ImgLoader()
{
@Override
public SetupImgLoader< ? > getSetupImgLoader( int setupId )
{
return new MySetupImgLoader( setupId );
}
};
for ( final ViewSetup vs : setups )
{
final ViewRegistration vr = new ViewRegistration( t.get( 0 ).getId(), vs.getId() );
final double minResolution = Math.min( Math.min( vs.getVoxelSize().dimension( 0 ), vs.getVoxelSize().dimension( 1 ) ), vs.getVoxelSize().dimension( 2 ) );
final double calX = vs.getVoxelSize().dimension( 0 ) / minResolution;
final double calY = vs.getVoxelSize().dimension( 1 ) / minResolution;
final double calZ = vs.getVoxelSize().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 );
vr.preconcatenateTransform( vt );
vr.updateModel();
registrations.add( vr );
}
final SequenceDescription sd = new SequenceDescription( timepoints, setups, imgLoader, missingViews );
final SpimData data = new SpimData( new File( "" ), sd, new ViewRegistrations( registrations ) );
return data;
}
示例8: createSpimData
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的package包/类
public static final SpimDataMinimal createSpimData( IFormatReader reader )
{
Hashtable< String, Object > gmeta = reader.getGlobalMetadata();
System.out.println( gmeta ); // header stuff here TODO
// get relevant metadata
double pw = 1.0;
double ph = 1.0;
double pd = 1.0;
if( gmeta.keySet().contains( "XResolution" ))
pw = ((Double)gmeta.get("XResolution")).doubleValue();
if( gmeta.keySet().contains( "YResolution" ))
ph = ((Double)gmeta.get("YResolution")).doubleValue();
if( gmeta.keySet().contains( "Spacing" ))
pd = ((Double)gmeta.get("Spacing")).doubleValue();
int numSetups = 1;
int numTimepoints = 1;
int[] ids = new int[]{ 349812342 };
final File basePath = new File( "." );
String punit = "px";
if( gmeta.keySet().contains( "Unit" ))
punit = (String) gmeta.get( "Unit" );
final FinalVoxelDimensions voxelSize = new FinalVoxelDimensions( punit, pw, ph, pd );
final long w = ((Long)gmeta.get("ImageWidth")).longValue();
final long h = ((Long)gmeta.get("ImageLength")).longValue();
final long d = reader.getSizeZ(); //Long.parseLong( (String)gmeta.get("images") );
long[] dims = new long[]{ w, h, d };
final FinalDimensions size = new FinalDimensions( new long[] { w, h, d } );
// create setups from channels
final HashMap< Integer, BasicViewSetup > setups = new HashMap< Integer, BasicViewSetup >( numSetups );
for ( int s = 0; s < numSetups; ++s )
{
final BasicViewSetup setup = new BasicViewSetup( ids[ s ], String.format( "channel %d", ids[ s ] + 1 ), size, voxelSize );
setup.setAttribute( new Channel( ids[ s ] + 1 ) );
setups.put( ids[ s ], setup );
}
// create timepoints
final ArrayList< TimePoint > timepoints = new ArrayList< TimePoint >( numTimepoints );
for ( int t = 0; t < numTimepoints; ++t )
timepoints.add( new TimePoint( t ) );
// create ViewRegistrations from the images calibration
final AffineTransform3D sourceTransform = new AffineTransform3D();
sourceTransform.set( 1.0/pw, 0, 0, 0, 0, 1.0/ph, 0, 0, 0, 0, pd, 0 );
final ArrayList< ViewRegistration > registrations = new ArrayList< ViewRegistration >();
for ( int t = 0; t < numTimepoints; ++t )
for ( int s = 0; s < numSetups; ++s )
registrations.add( new ViewRegistration( t, ids[ s ], sourceTransform ) );
final SequenceDescriptionMinimal seq = new SequenceDescriptionMinimal( new TimePoints( timepoints ), setups,
new DummyImageLoader< FloatType >( new FloatType(), dims ), null );
SpimDataMinimal spimData = new SpimDataMinimal( basePath, seq, new ViewRegistrations( registrations ) );
if ( WrapBasicImgLoader.wrapImgLoaderIfNecessary( spimData ) )
System.err.println( "WARNING:\nOpening <SpimData> dataset that is not suited for interactive browsing.\nConsider resaving as HDF5 for better performance." );
return spimData;
}
示例9: createSpimData
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的package包/类
public final SpimDataMinimal createSpimData()
{
int numSetups = 1;
int numTimepoints = 1;
int[] ids = new int[]{ 349812342 };
final File basePath = new File( "." );
double pw = spacingFull[ 0 ];
double ph = spacingFull[ 1 ];
double pd = spacingFull[ 2 ];
double ox = offsetFull[ 0 ] / spacingFull[ 0 ];
double oy = offsetFull[ 1 ] / spacingFull[ 1 ];
double oz = offsetFull[ 2 ] / spacingFull[ 2 ];
String punit = "px";
final FinalVoxelDimensions voxelSize = new FinalVoxelDimensions( punit, pw, ph, pd );
final long w = dimsFull[ 0 ];
final long h = dimsFull[ 1 ];
final long d = dimsFull[ 2 ];
final FinalDimensions size = new FinalDimensions( new long[] { w, h, d } );
// create setups from channels
final HashMap< Integer, BasicViewSetup > setups = new HashMap< Integer, BasicViewSetup >( numSetups );
for ( int s = 0; s < numSetups; ++s )
{
final BasicViewSetup setup = new BasicViewSetup( ids[ s ], String.format( "channel %d", ids[ s ] + 1 ), size, voxelSize );
setup.setAttribute( new Channel( ids[ s ] + 1 ) );
setups.put( ids[ s ], setup );
}
// create timepoints
final ArrayList< TimePoint > timepoints = new ArrayList< TimePoint >( numTimepoints );
for ( int t = 0; t < numTimepoints; ++t )
timepoints.add( new TimePoint( t ) );
// create ViewRegistrations from the images calibration
final AffineTransform3D sourceTransform = new AffineTransform3D();
sourceTransform.set( pw, 0, 0, ox, 0, ph, 0, oy, 0, 0, pd, oz );
final ArrayList< ViewRegistration > registrations = new ArrayList< ViewRegistration >();
for ( int t = 0; t < numTimepoints; ++t )
for ( int s = 0; s < numSetups; ++s )
registrations.add( new ViewRegistration( t, ids[ s ], sourceTransform ) );
final SequenceDescriptionMinimal seq = new SequenceDescriptionMinimal( new TimePoints( timepoints ), setups,
new DummyImageLoader< FloatType >( new FloatType(), this ), null );
SpimDataMinimal spimData = new SpimDataMinimal( basePath, seq, new ViewRegistrations( registrations ) );
if ( WrapBasicImgLoader.wrapImgLoaderIfNecessary( spimData ) )
System.err.println( "WARNING:\nOpening <SpimData> dataset that is not suited for interactive browsing.\nConsider resaving as HDF5 for better performance." );
return spimData;
}
示例10: getVoxelSize
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的package包/类
@Override
public VoxelDimensions getVoxelSize( final int timepointId )
{
return new FinalVoxelDimensions( "px", 1, 1, 1 );
}
示例11: createViewSetups
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的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 SlideBook6MetaData meta) {
// TODO: query rotation angle of each SlideBook channel
final double[] yaxis = new double[]{0, 1, 0};
final ArrayList<Angle> angles = new ArrayList<Angle>();
final Angle angleA = new Angle(0, "Path_A");
angleA.setRotation(yaxis, defaultAngles[0]);
angles.add(angleA);
final Angle angleB = new Angle(1, "Path_B");
angleB.setRotation(yaxis, defaultAngles[1]);
angles.add(angleB);
// define multiple illuminations, one for every capture in the slide file
final ArrayList<ViewSetup> viewSetups = new ArrayList<ViewSetup>();
int firstCapture = defaultCapture;
int numCaptures = 1;
if (defaultCapture == -1) {
firstCapture = 0;
numCaptures = meta.numCaptures();
}
// create one illumination for each capture if defaultCapture == -1, otherwise just one capture
for (int capture = firstCapture; capture < firstCapture + numCaptures; capture++) {
final int channels = meta.numChannels(capture);
// multi-angle captures must have pairs of channels
if (channels > 1 && channels % 2 == 0) {
String imageName = meta.imageName(capture);
imageName = imageName.replaceAll("[^a-zA-Z0-9_-]", "_"); // convert illegal characters to _
imageName = imageName.toLowerCase(); // convert to lowercase
// up to 8 illuminations (SlideBook channels) per SlideBook capture
final Illumination i = new Illumination(capture * 8, imageName);
for (int ch = 0; ch < channels / 2; ch++) {
// use name of first channel, SlideBook channels are diSPIM angles and each SlideBook image should have two angles per channel
String channelName = meta.channels(capture)[ch * 2];
channelName = channelName.replaceAll("[^a-zA-Z0-9_-]", "_"); // convert illegal characters to _
channelName = channelName.toLowerCase(); // convert to lowercase
final Channel channel = new Channel(ch, channelName);
for (final Angle a : angles) {
float voxelSizeUm = defaultCalibrations[0];
float zSpacing = defaultCalibrations[2];
final VoxelDimensions voxelSize = new FinalVoxelDimensions("um", voxelSizeUm, voxelSizeUm, zSpacing);
final Dimensions dim = new FinalDimensions(new long[]{meta.imageSize(capture)[0], meta.imageSize(capture)[1], meta.imageSize(capture)[2]});
viewSetups.add(new ViewSetup(viewSetups.size(), a.getName(), dim, voxelSize, channel, a, i));
}
}
}
}
return viewSetups;
}
示例12: assembleNewViewSetupsFusion
import mpicbg.spim.data.sequence.FinalVoxelDimensions; //导入依赖的package包/类
/**
* Creates one new Angle and one new Illumination for the fused dataset.
* The size of the List> ViewSetup < is therefore equal to the number of channels
*
* @param spimData
* @param viewIdsToProcess
* @param bb
* @param newAngleName
* @param newIlluminationName
* @return
*/
public static Map< ViewSetup, ViewSetup > assembleNewViewSetupsFusion(
final SpimData2 spimData,
final List< ViewId > viewIdsToProcess,
final BoundingBoxGUI bb,
final String newAngleName,
final String newIlluminationName )
{
final HashMap< ViewSetup, ViewSetup > map = new HashMap< ViewSetup, ViewSetup >();
int maxViewSetupIndex = -1;
int maxAngleIndex = -1;
int maxIllumIndex = -1;
// make a new viewsetup
for ( final ViewSetup v : spimData.getSequenceDescription().getViewSetups().values() )
maxViewSetupIndex = Math.max( maxViewSetupIndex, v.getId() );
// that has a new angle
for ( final Angle a : spimData.getSequenceDescription().getAllAngles().values() )
maxAngleIndex = Math.max( maxAngleIndex, a.getId() );
// and a new illumination
for ( final Illumination i : spimData.getSequenceDescription().getAllIlluminations().values() )
maxIllumIndex = Math.max( maxIllumIndex, i.getId() );
final Angle newAngle = new Angle( maxAngleIndex + 1, newAngleName + "_" + ( maxAngleIndex + 1 ) );
final Illumination newIllum = new Illumination( maxIllumIndex + 1, newIlluminationName + "_" + ( maxIllumIndex + 1 ) );
final String unit = spimData.getSequenceDescription().getViewSetupsOrdered().get( 0 ).getVoxelSize().unit();
// get the minimal resolution of all calibrations relative to the downsampling
final double minResolution = Apply_Transformation.assembleAllMetaData(
spimData.getSequenceDescription(),
spimData.getSequenceDescription().getViewDescriptions().values() ) * bb.getDownSampling();
// one new new viewsetup for every channel that is fused (where fused means combining one or more angles&illuminations into one new image)
for ( final Channel channel : SpimData2.getAllChannelsSorted( spimData, viewIdsToProcess ) )
{
final ViewSetup newSetup = new ViewSetup(
++maxViewSetupIndex,
null,
new FinalDimensions( bb.getDimensions() ),
new FinalVoxelDimensions ( unit, new double[]{ minResolution, minResolution, minResolution } ),
channel,
newAngle,
newIllum );
// all viewsetups of the current channel that are fused point to the same new viewsetup
for ( final ViewId viewId : viewIdsToProcess )
{
final ViewDescription oldVD = spimData.getSequenceDescription().getViewDescription( viewId );
final ViewSetup oldSetup = oldVD.getViewSetup();
// is this old setup from the current channel? then point to it
if ( oldVD.isPresent() && oldSetup.getChannel().getId() == channel.getId() )
map.put( oldSetup, newSetup );
}
}
return map;
}