本文整理汇总了Java中mpicbg.spim.data.registration.ViewRegistration.updateModel方法的典型用法代码示例。如果您正苦于以下问题:Java ViewRegistration.updateModel方法的具体用法?Java ViewRegistration.updateModel怎么用?Java ViewRegistration.updateModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpicbg.spim.data.registration.ViewRegistration
的用法示例。
在下文中一共展示了ViewRegistration.updateModel方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLocalToGlobalTransform
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的package包/类
@Override
public void getLocalToGlobalTransform( final int timepointIndex, final AffineTransform3D transform )
{
if ( currentVD != null )
{
final ViewRegistration vr = panel.viewSetupExplorer.getSpimData().getViewRegistrations().getViewRegistration( currentVD );
vr.updateModel();
transform.set( vr.getModel() );
}
}
示例2: actionPerformed
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的package包/类
@Override
public void actionPerformed( final ActionEvent e )
{
if ( panel == null )
{
IOFunctions.println( "Panel not set for " + this.getClass().getSimpleName() );
return;
}
//final AbstractSpimData< ? > data = (AbstractSpimData< ? >)panel.getSpimData();
final List< ViewId > viewIds = panel.selectedRowsViewId();
final ViewRegistrations vr = panel.getSpimData().getViewRegistrations();
for ( final ViewId viewId : viewIds )
{
final ViewRegistration v = vr.getViewRegistrations().get( viewId );
if ( index == 0 )
v.getTransformList().remove( 0 );
else
v.getTransformList().remove( v.getTransformList().size() - 1 );
v.updateModel();
}
panel.updateContent();
ViewSetupExplorerPanel.bdvPopup().updateBDV();
}
示例3: delete
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的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();
}
示例4: cleanUp
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的package包/类
/**
* Called before the XML is potentially saved
*/
@Override
public boolean cleanUp()
{
if ( reorientate == 0 || reorientate == 1 )
{
// the spimdata registrations were changed
return true;
}
else if ( reorientate == 2 )
{
// remove the registrations we added
if ( viewIdsToApply == null )
{
IOFunctions.println( "Something went wrong, the viewIdsToApply list is null." );
}
else
{
for ( final ViewId viewId : viewIdsToApply )
{
final ViewDescription vd = spimData.getSequenceDescription().getViewDescription( viewId );
if ( !vd.isPresent() )
continue;
// get the registration
final ViewRegistration r = spimData.getViewRegistrations().getViewRegistration( viewId );
final List< ViewTransform > vtl = r.getTransformList();
vtl.remove( 0 );
r.updateModel();
}
}
}
return this.changedSpimDataObject;
}
示例5: twoAngles
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的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;
}
示例6: applyToData
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的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();
}
}
示例7: openVirtuallyFused
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的package包/类
public static <S extends AbstractSequenceDescription< ?,? extends BasicViewDescription<? extends BasicViewSetup>, ? >>
List<RandomAccessibleInterval< FloatType >> openVirtuallyFused(
S sd,
ViewRegistrations vrs,
Collection<? extends Collection<ViewId>> views,
Interval boundingBox,
double[] downsamplingFactors)
{
final BasicImgLoader imgLoader = sd.getImgLoader();
final List<RandomAccessibleInterval< FloatType >> openImgs = new ArrayList<>();
final Interval bbSc = TransformVirtual.scaleBoundingBox( new FinalInterval( boundingBox ), inverse( downsamplingFactors ));
final long[] dim = new long[ bbSc.numDimensions() ];
bbSc.dimensions( dim );
for (Collection<ViewId> viewGroup : views)
{
final ArrayList< RandomAccessibleInterval< FloatType > > images = new ArrayList<>();
final ArrayList< RandomAccessibleInterval< FloatType > > weights = new ArrayList<>();
for ( final ViewId viewId : viewGroup )
{
final ViewRegistration vr = vrs.getViewRegistration( viewId );
vr.updateModel();
AffineTransform3D model = vr.getModel();
final float[] blending = Util.getArrayFromValue( FusionTools.defaultBlendingRange, 3 );
final float[] border = Util.getArrayFromValue( FusionTools.defaultBlendingBorder, 3 );
model = model.copy();
TransformVirtual.scaleTransform( model, inverse(downsamplingFactors) );
final RandomAccessibleInterval inputImg = DownsampleTools.openDownsampled( imgLoader, viewId, model );
System.out.println( model.inverse() );
FusionTools.adjustBlending( sd.getViewDescriptions().get( viewId ), blending, border, model );
images.add( TransformView.transformView( inputImg, model, bbSc, 0, 1 ) );
weights.add( TransformWeight.transformBlending( inputImg, border, blending, model, bbSc ) );
}
openImgs.add( new FusedRandomAccessibleInterval( new FinalInterval( dim ), images, weights ) );
}
return openImgs;
}
示例8: actionPerformed
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的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();
}
示例9: pasteSelection
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的package包/类
/**
*
* @param type 0 == before, 1 == replace, 2 == after
*/
protected void pasteSelection( final int type )
{
if ( cache.size() == 0 )
{
JOptionPane.showMessageDialog( table, "Nothing copied so far." );
return;
}
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 ViewRegistration vr = tableModel.getViewRegistrations().getViewRegistration( vd );
// check out where to start inserting
final int[] selectedRows = table.getSelectedRows();
Arrays.sort( selectedRows );
int insertAt;
if ( type == 0 )
{
insertAt = selectedRows[ 0 ];
}
else if ( type == 1 )
{
insertAt = selectedRows[ 0 ];
// remove the selected entries
for ( int i = selectedRows[ selectedRows.length - 1 ]; i >= selectedRows[ 0 ]; --i )
vr.getTransformList().remove( i );
}
else
{
insertAt = selectedRows[ selectedRows.length - 1 ] + 1;
}
// add the new entries
final ArrayList< ViewTransform > newList = new ArrayList< ViewTransform >();
// add the old entries
for ( int i = 0; i < insertAt; ++i )
newList.add( vr.getTransformList().get( i ) );
// add the copied ones
for ( int i = 0; i < cache.size(); ++i )
newList.add( duplicate( cache.get( i ) ) );
// add the rest
for ( int i = insertAt; i < vr.getTransformList().size(); ++i )
newList.add( vr.getTransformList().get( i ) );
vr.getTransformList().clear();
vr.getTransformList().addAll( newList );
vr.updateModel();
// update everything
tableModel.fireTableDataChanged();
}
示例10: getInterestPoints
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的package包/类
/**
* Creates lists of input points for the registration, based on the current transformation of the views
*
* Note: this always duplicates the location array from the input List> InterestPoint < !!!
*
* @param timepoint
*/
protected HashMap< ViewId, MatchPointList > getInterestPoints( final TimePoint timepoint )
{
final HashMap< ViewId, MatchPointList > interestPoints = new HashMap< ViewId, MatchPointList >();
final ViewRegistrations registrations = spimData.getViewRegistrations();
final ViewInterestPoints interestpoints = spimData.getViewInterestPoints();
for ( final ViewDescription vd : SpimData2.getAllViewIdsForTimePointSorted( spimData, viewIdsToProcess, timepoint) )
{
if ( !vd.isPresent() )
continue;
final ChannelProcess c = getChannelProcessForChannel( channelsToProcess, vd.getViewSetup().getChannel() );
// no registration for this viewdescription
if ( c == null )
continue;
final Angle a = vd.getViewSetup().getAngle();
final Illumination i = vd.getViewSetup().getIllumination();
// assemble a new list
final ArrayList< InterestPoint > list = new ArrayList< InterestPoint >();
// check the existing lists of points
final ViewInterestPointLists lists = interestpoints.getViewInterestPointLists( vd );
if ( !lists.contains( c.getLabel() ) )
{
IOFunctions.println( "Interest points for label '" + c.getLabel() + "' not found for timepoint: " + timepoint.getId() + " angle: " +
a.getId() + " channel: " + c.getChannel().getId() + " illum: " + i.getId() );
continue;
}
if ( lists.getInterestPointList( c.getLabel() ).getInterestPoints() == null )
{
if ( !lists.getInterestPointList( c.getLabel() ).loadInterestPoints() )
{
IOFunctions.println( "Interest points for label '" + c.getLabel() + "' could not be loaded for timepoint: " + timepoint.getId() + " angle: " +
a.getId() + " channel: " + c.getChannel().getId() + " illum: " + i.getId() );
continue;
}
}
final List< InterestPoint > ptList = lists.getInterestPointList( c.getLabel() ).getInterestPoints();
final ViewRegistration r = registrations.getViewRegistration( vd );
r.updateModel();
final AffineTransform3D m = r.getModel();
for ( final InterestPoint p : ptList )
{
final double[] l = new double[ 3 ];
m.apply( p.getL(), l );
list.add( new InterestPoint( p.getId(), l ) );
}
interestPoints.put( vd, new MatchPointList( list, c ) );
}
return interestPoints;
}
示例11: computeMaxBoundingBoxDimensions
import mpicbg.spim.data.registration.ViewRegistration; //导入方法依赖的package包/类
/**
* @param spimData
* @param viewIdsToProcess
* @param minBB
* @param maxBB
* @return - true if the SpimData object was modified, otherwise false
*/
public static boolean computeMaxBoundingBoxDimensions( final SpimData2 spimData, final List< ViewId > viewIdsToProcess, final double[] minBB, final double[] maxBB )
{
for ( int d = 0; d < minBB.length; ++d )
{
minBB[ d ] = Double.MAX_VALUE;
maxBB[ d ] = -Double.MAX_VALUE;
}
boolean changed = false;
IOFunctions.println( new Date( System.currentTimeMillis() ) + ": Estimating Bounding Box for Fusion. If size of images is not known (they were never opened before), some of them need to be opened once to determine their size.");
for ( final ViewId viewId : viewIdsToProcess )
{
final ViewDescription viewDescription = spimData.getSequenceDescription().getViewDescription(
viewId.getTimePointId(), viewId.getViewSetupId() );
if ( !viewDescription.isPresent() )
continue;
if ( !viewDescription.getViewSetup().hasSize() )
changed = true;
final Dimensions size = ViewSetupUtils.getSizeOrLoad( viewDescription.getViewSetup(), viewDescription.getTimePoint(), spimData.getSequenceDescription().getImgLoader() );
final double[] min = new double[]{ 0, 0, 0 };
final double[] max = new double[]{
size.dimension( 0 ) - 1,
size.dimension( 1 ) - 1,
size.dimension( 2 ) - 1 };
final ViewRegistration r = spimData.getViewRegistrations().getViewRegistration( viewId );
r.updateModel();
final FinalRealInterval interval = r.getModel().estimateBounds( new FinalRealInterval( min, max ) );
for ( int d = 0; d < minBB.length; ++d )
{
minBB[ d ] = Math.min( minBB[ d ], interval.realMin( d ) );
maxBB[ d ] = Math.max( maxBB[ d ], interval.realMax( d ) );
}
}
return changed;
}