本文整理汇总了Java中mpicbg.spim.data.generic.sequence.BasicViewSetup.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java BasicViewSetup.setAttribute方法的具体用法?Java BasicViewSetup.setAttribute怎么用?Java BasicViewSetup.setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpicbg.spim.data.generic.sequence.BasicViewSetup
的用法示例。
在下文中一共展示了BasicViewSetup.setAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSpimData
import mpicbg.spim.data.generic.sequence.BasicViewSetup; //导入方法依赖的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;
}
示例2: createSpimData
import mpicbg.spim.data.generic.sequence.BasicViewSetup; //导入方法依赖的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;
}