本文整理汇总了Java中mpicbg.spim.data.registration.ViewTransformAffine类的典型用法代码示例。如果您正苦于以下问题:Java ViewTransformAffine类的具体用法?Java ViewTransformAffine怎么用?Java ViewTransformAffine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewTransformAffine类属于mpicbg.spim.data.registration包,在下文中一共展示了ViewTransformAffine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setModelToCalibration
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的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 );
}
示例2: exportImage
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
@Override
public < T extends RealType< T > & NativeType< T > > boolean exportImage( final RandomAccessibleInterval<T> img, final BoundingBoxGUI bb, final TimePoint tp, final ViewSetup vs, final double min, final double max )
{
if ( appendToHdf5 != null )
return appendToHdf5.exportImage( img, bb, tp, vs, min, max );
// write the image
if ( !this.saver.exportImage( img, bb, tp, vs, min, max ) )
return false;
// update the registrations
final ViewRegistration vr = spimData.getViewRegistrations().getViewRegistration( new ViewId( tp.getId(), vs.getId() ) );
final double scale = bb.getDownSampling();
final AffineTransform3D m = new AffineTransform3D();
m.set( scale, 0.0f, 0.0f, bb.min( 0 ),
0.0f, scale, 0.0f, bb.min( 1 ),
0.0f, 0.0f, scale, bb.min( 2 ) );
final ViewTransform vt = new ViewTransformAffine( "fusion bounding box", m );
vr.getTransformList().clear();
vr.getTransformList().add( vt );
return true;
}
示例3: exportImage
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
@Override
public < T extends RealType< T > & NativeType< T > > boolean exportImage( final RandomAccessibleInterval<T> img, final BoundingBoxGUI bb, final TimePoint tp, final ViewSetup vs, final double min, final double max )
{
// write the image
if ( !this.saver.exportImage( img, bb, tp, vs, min, max ) )
return false;
// update the registrations
final ViewRegistration vr = spimData.getViewRegistrations().getViewRegistration( new ViewId( tp.getId(), vs.getId() ) );
final double scale = bb.getDownSampling();
final AffineTransform3D m = new AffineTransform3D();
m.set( scale, 0.0f, 0.0f, bb.min( 0 ),
0.0f, scale, 0.0f, bb.min( 1 ),
0.0f, 0.0f, scale, bb.min( 2 ) );
final ViewTransform vt = new ViewTransformAffine( "fusion bounding box", m );
vr.getTransformList().clear();
vr.getTransformList().add( vt );
return true;
}
示例4: createViewRegistrations
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
public static ViewRegistrations createViewRegistrations()
{
final HashMap< ViewId, ViewRegistration > registrations = new HashMap< ViewId, ViewRegistration >();
registrations.put( new ViewId( 21, 1 ), new ViewRegistration( 21, 1 ) );
final AffineTransform3D t00 = new AffineTransform3D();
t00.set( 1, 0, 0, 1.3, 0, 1, 0, 1.3, 0, 0, 1, 2.3 );
registrations.put( new ViewId( 1, 0 ), new ViewRegistration( 0, 0, t00 ) );
final ArrayList< ViewTransform > list = new ArrayList< ViewTransform >();
list.add( new ViewTransformAffine( null, t00 ) );
list.add( new ViewTransformAffine( "identity", new AffineTransform3D() ) );
registrations.put( new ViewId( 41, 1 ), new ViewRegistration( 41, 1, list ) );
final ViewRegistrations viewRegistrations = new ViewRegistrations( registrations );
return viewRegistrations;
}
示例5: preConcatenateTransform
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
public static void preConcatenateTransform( final SpimData spimData, final ViewId viewId, final AffineTransform3D model, final String name )
{
final ViewRegistrations viewRegistrations = spimData.getViewRegistrations();
// update the view registration
final ViewRegistration vr = viewRegistrations.getViewRegistration( viewId );
final ViewTransform vt = new ViewTransformAffine( name, model );
vr.preconcatenateTransform( vt );
}
示例6: createViewRegistrations
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的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 );
}
示例7: duplicate
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
protected static ViewTransform duplicate( final ViewTransform vt )
{
final AffineTransform3D t = new AffineTransform3D();
t.set( vt.asAffine3D().getRowPackedCopy() );
return new ViewTransformAffine( vt.getName(), t );
}
示例8: newName
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
protected static ViewTransform newName( final ViewTransform vt, final String name )
{
final AffineTransform3D t = new AffineTransform3D();
t.set( vt.asAffine3D().getRowPackedCopy() );
return new ViewTransformAffine( name, t );
}
示例9: newMatrixEntry
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
protected static ViewTransform newMatrixEntry( final ViewTransform vt, final double value, final int index )
{
final AffineTransform3D t = new AffineTransform3D();
final double[] m = vt.asAffine3D().getRowPackedCopy();
m[ index ] = value;
t.set( m );
return new ViewTransformAffine( vt.getName(), t );
}
示例10: delete
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
protected void delete()
{
if ( table.getSelectedRowCount() == 0 )
{
JOptionPane.showMessageDialog( table, "Nothing selected." );
return;
}
final BasicViewDescription< ? > vd = tableModel.getCurrentViewDescription();
if ( vd == null )
{
JOptionPane.showMessageDialog( table, "No active viewdescription." );
return;
}
final int[] selectedRows = table.getSelectedRows();
Arrays.sort( selectedRows );
final ViewRegistration vr = tableModel.getViewRegistrations().getViewRegistration( vd );
for ( int i = selectedRows[ selectedRows.length - 1 ]; i >= selectedRows[ 0 ]; --i )
vr.getTransformList().remove( i );
if ( vr.getTransformList().isEmpty() )
vr.getTransformList().add( new ViewTransformAffine( null, new AffineTransform3D() ) );
vr.updateModel();
// update everything
tableModel.fireTableDataChanged();
}
示例11: exportImage
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public < T extends RealType< T > & NativeType< T > > boolean exportImage( RandomAccessibleInterval< T > img, BoundingBoxGUI bb, TimePoint tp, ViewSetup vs, double min, double max )
{
System.out.println( "exportImage2()" );
// write the image
final RandomAccessibleInterval< UnsignedShortType > ushortimg;
if ( ! UnsignedShortType.class.isInstance( Util.getTypeFromInterval( img ) ) )
ushortimg = convert( img, params );
else
ushortimg = ( RandomAccessibleInterval ) img;
final Partition partition = viewIdToPartition.get( new ViewId( tp.getId(), vs.getId() ) );
final ExportMipmapInfo mipmapInfo = perSetupExportMipmapInfo.get( vs.getId() );
final boolean writeMipmapInfo = true; // TODO: remember whether we already wrote it and write only once
final boolean deflate = params.getDeflate();
final ProgressWriter progressWriter = new SubTaskProgressWriter( this.progressWriter, 0.0, 1.0 ); // TODO
final int numThreads = Math.max( 1, Runtime.getRuntime().availableProcessors() - 2 );
WriteSequenceToHdf5.writeViewToHdf5PartitionFile( ushortimg, partition, tp.getId(), vs.getId(), mipmapInfo, writeMipmapInfo, deflate, null, null, numThreads, progressWriter );
// update the registrations
final ViewRegistration vr = spimData.getViewRegistrations().getViewRegistration( new ViewId( tp.getId(), vs.getId() ) );
final double scale = bb.getDownSampling();
final AffineTransform3D m = new AffineTransform3D();
m.set( scale, 0.0f, 0.0f, bb.min( 0 ),
0.0f, scale, 0.0f, bb.min( 1 ),
0.0f, 0.0f, scale, bb.min( 2 ) );
final ViewTransform vt = new ViewTransformAffine( "fusion bounding box", m );
vr.getTransformList().clear();
vr.getTransformList().add( vt );
return true;
}
示例12: exportImage
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
@SuppressWarnings( { "unchecked", "rawtypes" } )
@Override
public < T extends RealType< T > & NativeType< T > > boolean exportImage( RandomAccessibleInterval< T > img, BoundingBoxGUI bb, TimePoint tp, ViewSetup vs, double min, double max )
{
System.out.println( "exportImage2()" );
// write the image
final RandomAccessibleInterval< UnsignedShortType > ushortimg;
if ( ! UnsignedShortType.class.isInstance( Util.getTypeFromInterval( img ) ) )
ushortimg = ExportSpimData2HDF5.convert( img, params );
else
ushortimg = ( RandomAccessibleInterval ) img;
final Partition partition = viewIdToPartition.get( new ViewId( tp.getId(), vs.getId() ) );
final ExportMipmapInfo mipmapInfo = perSetupExportMipmapInfo.get( vs.getId() );
final boolean writeMipmapInfo = true; // TODO: remember whether we already wrote it and write only once
final boolean deflate = params.getDeflate();
final ProgressWriter progressWriter = new SubTaskProgressWriter( this.progressWriter, 0.0, 1.0 ); // TODO
final int numThreads = Math.max( 1, Runtime.getRuntime().availableProcessors() - 2 );
WriteSequenceToHdf5.writeViewToHdf5PartitionFile( ushortimg, partition, tp.getId(), vs.getId(), mipmapInfo, writeMipmapInfo, deflate, null, null, numThreads, progressWriter );
// update the registrations
final ViewRegistration vr = spimData.getViewRegistrations().getViewRegistration( new ViewId( tp.getId(), vs.getId() ) );
final double scale = bb.getDownSampling();
final AffineTransform3D m = new AffineTransform3D();
m.set( scale, 0.0f, 0.0f, bb.min( 0 ),
0.0f, scale, 0.0f, bb.min( 1 ),
0.0f, 0.0f, scale, bb.min( 2 ) );
final ViewTransform vt = new ViewTransformAffine( "fusion bounding box", m );
vr.getTransformList().clear();
vr.getTransformList().add( vt );
return true;
}
示例13: twoAngles
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的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;
}
示例14: applyToData
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
public static void applyToData(Map<ViewId, Translation3D> locations, boolean pixelUnits, boolean keepRotation,
AbstractSpimData< ? > data)
{
if (data == null)
return;
final Map< ViewId, Translation3D > transformsForData = getTransformsForData( locations, pixelUnits, data );
final Collection< BasicViewDescription< ? > > vds = (Collection< BasicViewDescription< ? > >) data.getSequenceDescription().getViewDescriptions().values();
for ( BasicViewDescription< ? > vd : vds )
{
if (!vd.isPresent())
continue;
if (!transformsForData.containsKey( vd ))
continue;
final ViewRegistration vr = data.getViewRegistrations().getViewRegistration( vd );
final ViewTransform vtCalib = vr.getTransformList().get( vr.getTransformList().size() - 1 );
final AffineTransform3D calib = new AffineTransform3D();
calib.set( vr.getTransformList().get( vr.getTransformList().size() - 1 ).asAffine3D().getRowPackedCopy() );
vr.getTransformList().clear();
vr.preconcatenateTransform( vtCalib );
final AffineTransform3D tr = new AffineTransform3D();
tr.set( transformsForData.get( vd ).getRowPackedCopy() );
ViewTransformAffine vtTC = new ViewTransformAffine( "Translation from Tile Configuration", tr );
vr.preconcatenateTransform( vtTC );
if (keepRotation)
{
AffineTransform3D rotation = new AffineTransform3D();
Pair< Double, Integer > rotAngleAndAxis = RegularTranformHelpers.getRoatationFromMetadata( vd.getViewSetup().getAttribute( Angle.class ) );
if (rotAngleAndAxis != null)
{
rotation.rotate( rotAngleAndAxis.getB(), rotAngleAndAxis.getA() );
vr.preconcatenateTransform( new ViewTransformAffine( "Rotation from Metadata", rotation.copy() ));
}
}
vr.updateModel();
}
}
示例15: actionPerformed
import mpicbg.spim.data.registration.ViewTransformAffine; //导入依赖的package包/类
@Override
public void actionPerformed( final ActionEvent e )
{
if ( panel == null )
{
IOFunctions.println( "Panel not set for " + this.getClass().getSimpleName() );
return;
}
BigDataViewer bdv = panel.bdvPopup().getBDV();
if (bdv == null)
{
IOFunctions.println( "BigDataViewer is not open. Please start it to access this functionality." );
return;
}
for (int i = 0; i < bdv.getViewer().getVisibilityAndGrouping().numSources(); ++i)
{
Integer tpId = bdv.getViewer().getState().getCurrentTimepoint();
SourceState<?> s = bdv.getViewer().getVisibilityAndGrouping().getSources().get( i );
// get manual transform
AffineTransform3D tAffine = new AffineTransform3D();
((TransformedSource< ? >)s.getSpimSource()).getFixedTransform( tAffine );
// get old transform
ViewRegistration vr = panel.getSpimData().getViewRegistrations().getViewRegistration( new ViewId(tpId, i ));
AffineGet old = vr.getTransformList().get( 1 ).asAffine3D();
// update transform in ViewRegistrations
AffineTransform3D newTransform = new AffineTransform3D();
newTransform.set( old.get( 0, 3 ) + tAffine.get( 0, 3 ), 0, 3 );
newTransform.set( old.get( 1, 3 ) + tAffine.get( 1, 3 ), 1, 3 );
newTransform.set( old.get( 2, 3 ) + tAffine.get( 2, 3 ), 2, 3 );
ViewTransform newVt = new ViewTransformAffine( "Translation", newTransform );
vr.getTransformList().set( 1, newVt );
vr.updateModel();
// reset manual transform
((TransformedSource< ? >)s.getSpimSource()).setFixedTransform( new AffineTransform3D() );
bdv.getViewer().requestRepaint();
}
panel.bdvPopup().updateBDV();
}