public static ArrayList< ViewDescription > getAllViewDescriptionsSorted( final SpimData data, final List< ? extends ViewId > viewIds ) { final ArrayList< ViewDescription > vds = new ArrayList< ViewDescription >(); for ( final ViewId v : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( v ); if ( vd.isPresent() ) vds.add( vd ); } Collections.sort( vds ); return vds; }
public static void updateMissingViews( final SpimData2 spimData, final List< ViewId > viewIds ) { for ( final ViewId viewId : viewIds ) { final ViewDescription vd = spimData.getSequenceDescription().getViewDescription( viewId ); if ( !vd.isPresent() ) { for ( final ViewDescription vdc : spimData.getSequenceDescription().getViewDescriptions().values() ) { if ( vd.getViewSetup().getAngle() == vdc.getViewSetup().getAngle() && vd.getViewSetup().getChannel() == vdc.getViewSetup().getChannel() && vd.getViewSetup().getTile() == vdc.getViewSetup().getTile() && vdc.getViewSetupId() != vd.getViewSetupId() ) { System.out.println( "Missing view " + Group.pvid( vd ) + " compensated from " + Group.pvid( vdc ) ); final ViewRegistration vrc = spimData.getViewRegistrations().getViewRegistration( vdc ); vrc.updateModel(); final ViewRegistration vr = spimData.getViewRegistrations().getViewRegistration( vd ); vr.getTransformList().clear(); vr.getTransformList().addAll( vrc.getTransformList() ); vr.updateModel(); } } } } }
public static ArrayList< TimePoint > getAllTimePointsSorted( final SpimData data, final Collection< ? extends ViewId > viewIds ) { final ArrayList< ViewDescription > vds = new ArrayList< ViewDescription >(); for ( final ViewId v : viewIds ) vds.add( data.getSequenceDescription().getViewDescription( v ) ); return getAllTimePointsSorted( vds ); }
public static < V extends ViewId > ArrayList< Pair< Channel, Channel > > identifyChannelPairs( final SpimData2 spimData, final List< V > viewIds ) { final SequenceDescription seq = spimData.getSequenceDescription(); final HashSet< Channel > channelSet = new HashSet<>(); for ( final V viewId : viewIds ) channelSet.add( seq.getViewDescription( viewId ).getViewSetup().getChannel() ); final ArrayList< Channel > channels = new ArrayList<>( channelSet ); Collections.sort( channels ); final ArrayList< Pair< Channel, Channel > > channelPairs = new ArrayList<>(); for ( int c1 = 0; c1 < channels.size() - 1; ++c1 ) for ( int c2 = c1 + 1; c2 < channels.size(); ++c2 ) channelPairs.add( new ValuePair< Channel, Channel >( channels.get( c1 ), channels.get( c2 ) ) ); return channelPairs; }
public static ArrayList< ViewSetup > getAllViewSetupsSorted( final SpimData data, final Collection< ? extends ViewId > viewIds ) { final HashSet< ViewSetup > setups = new HashSet< ViewSetup >(); for ( final ViewId viewId : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( viewId ); final ViewSetup setup = vd.getViewSetup(); if ( vd.isPresent() ) setups.add( setup ); } final ArrayList< ViewSetup > setupList = new ArrayList< ViewSetup >(); setupList.addAll( setups ); Collections.sort( setupList ); return setupList; }
public static ArrayList< Channel > getAllChannelsSorted( final SpimData data, final Collection< ? extends ViewId > viewIds ) { final HashSet< Channel > channelSet = new HashSet< Channel >(); for ( final ViewId v : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( v ); if ( vd.isPresent() ) channelSet.add( vd.getViewSetup().getChannel() ); } final ArrayList< Channel > channels = new ArrayList< Channel >(); channels.addAll( channelSet ); Collections.sort( channels ); return channels; }
public static ArrayList< Angle > getAllAnglesSorted( final SpimData data, final Collection< ? extends ViewId > viewIds ) { final HashSet< Angle > angleSet = new HashSet< Angle >(); for ( final ViewId v : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( v ); if ( vd.isPresent() ) angleSet.add( vd.getViewSetup().getAngle() ); } final ArrayList< Angle > angles = new ArrayList< Angle >(); angles.addAll( angleSet ); Collections.sort( angles ); return angles; }
public static ArrayList< Tile > getAllTilesSorted( final SpimData data, final Collection< ? extends ViewId > viewIds ) { final HashSet< Tile > tileSet = new HashSet<>(); for ( final ViewId v : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( v ); if ( vd.isPresent() ) tileSet.add( vd.getViewSetup().getTile() ); } final ArrayList< Tile > tiles = new ArrayList<>(); tiles.addAll( tileSet ); Collections.sort( tiles ); return tiles; }
public static ArrayList< Illumination > getAllIlluminationsSorted( final SpimData data, final Collection< ? extends ViewId > viewIds ) { final HashSet< Illumination > illumSet = new HashSet< Illumination >(); for ( final ViewId v : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( v ); if ( vd.isPresent() ) illumSet.add( vd.getViewSetup().getIllumination() ); } final ArrayList< Illumination > illums = new ArrayList< Illumination >(); illums.addAll( illumSet ); Collections.sort( illums ); return illums; }
public static ArrayList< ViewDescription > getAllViewIdsForTimePointSorted( final SpimData data, final Collection< ? extends ViewId > viewIds, final TimePoint timepoint ) { final ArrayList< ViewDescription > views = new ArrayList< ViewDescription >(); for ( final ViewId id : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( id ); if ( vd.isPresent() && vd.getTimePointId() == timepoint.getId() ) views.add( vd ); } Collections.sort( views ); return views; }
public static ArrayList< ViewId > getAllViewIdsSorted( final SpimData data, final List< ? extends ViewSetup > setups, final List< ? extends TimePoint > tps ) { final ArrayList< ViewId > viewIds = new ArrayList< ViewId >(); for ( final TimePoint tp : tps ) for ( final ViewSetup vs : setups ) { final ViewId v = new ViewId( tp.getId(), vs.getId() ); final ViewDescription vd = data.getSequenceDescription().getViewDescription( v ); if ( vd.isPresent() ) viewIds.add( vd ); } Collections.sort( viewIds ); return viewIds; }
@Override public int compare( final ViewId o1, final ViewId o2 ) { return sd.getViewDescription( o1 ).getViewSetup().getChannel().getId() - sd.getViewDescription( o2 ).getViewSetup().getChannel().getId(); } } );
public static ArrayList< ViewDescription > getAllViewIdsForChannelSorted( final SpimData data, final Collection< ? extends ViewId > viewIds, final Channel channel ) { final ArrayList< ViewDescription > views = new ArrayList< ViewDescription >(); for ( final ViewId id : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( id ); if ( vd.isPresent() && vd.getViewSetup().getChannel().getId() == channel.getId() ) views.add( vd ); } Collections.sort( views ); return views; }
public static HashMap< String, Integer > assembleRegistrationNames( final SpimData data, final List< ViewId > viewIds ) { final ViewRegistrations vr = data.getViewRegistrations(); final SequenceDescription sd = data.getSequenceDescription(); final HashMap< String, Integer > names = new HashMap< String, Integer >(); for ( final ViewId viewId: viewIds ) { final ViewDescription vd = sd.getViewDescription( viewId ); if ( !vd.isPresent() ) continue; final ViewRegistration r = vr.getViewRegistration( vd ); final String rName = r.getTransformList().get( 0 ).getName(); if ( rName != null ) { if ( names.containsKey( rName ) ) names.put( rName, names.get( rName ) + 1 ); else names.put( rName, 1 ); } } return names; }
public static < T extends RealType< T > & NativeType< T > > boolean maxProject( final SpimData data, final List< ? extends ViewId > viewIds, final T type ) { final ArrayList< ViewDescription > list = new ArrayList< ViewDescription >(); for ( final ViewId viewId : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( viewId ); if ( vd != null && vd.isPresent() ) list.add( vd ); } return maxProject( list, data.getSequenceDescription().getImgLoader(), type ); }
public static ArrayList< ViewDescription > getAllViewIdsForChannelTimePointSorted( final SpimData data, final Collection< ? extends ViewId > viewIds, final Channel channel, final TimePoint timePoint ) { final ArrayList< ViewDescription > views = new ArrayList< ViewDescription >(); for ( final ViewId id : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( id ); if ( vd.isPresent() && vd.getViewSetup().getChannel().getId() == channel.getId() && id.getTimePointId() == timePoint.getId() ) views.add( vd ); } Collections.sort( views ); return views; }
public static ArrayList< Illumination > getAllIlluminationsForChannelTimepointSorted( final SpimData data, final Collection< ? extends ViewId > viewIds, final Channel c, final TimePoint t ) { final HashSet< Illumination > illumSet = new HashSet< Illumination >(); for ( final ViewId v : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( v ); if ( vd.isPresent() && v.getTimePointId() == t.getId() && vd.getViewSetup().getChannel().getId() == c.getId() ) illumSet.add( vd.getViewSetup().getIllumination() ); } final ArrayList< Illumination > illums = new ArrayList< Illumination >(); illums.addAll( illumSet ); Collections.sort( illums ); return illums; }
public static ArrayList< Angle > getAllAnglesForChannelTimepointSorted( final SpimData data, final Collection< ? extends ViewId > viewIds, final Channel c, final TimePoint t ) { final HashSet< Angle > angleSet = new HashSet< Angle >(); for ( final ViewId v : viewIds ) { final ViewDescription vd = data.getSequenceDescription().getViewDescription( v ); if ( vd.isPresent() && v.getTimePointId() == t.getId() && vd.getViewSetup().getChannel().getId() == c.getId() ) angleSet.add( vd.getViewSetup().getAngle() ); } final ArrayList< Angle > angles = new ArrayList< Angle >(); angles.addAll( angleSet ); Collections.sort( angles ); return angles; }
public static final ArrayList< ViewDescription > assembleInputData( final SpimData2 spimData, final TimePoint timepoint, final Channel channel, final List< ViewId > viewIdsToProcess ) { final ArrayList< ViewDescription > inputData = new ArrayList< ViewDescription >(); for ( final ViewId viewId : viewIdsToProcess ) { final ViewDescription vd = spimData.getSequenceDescription().getViewDescription( viewId.getTimePointId(), viewId.getViewSetupId() ); if ( !vd.isPresent() || vd.getTimePointId() != timepoint.getId() || vd.getViewSetup().getChannel().getId() != channel.getId() ) continue; // get the most recent model spimData.getViewRegistrations().getViewRegistration( viewId ).updateModel(); inputData.add( vd ); } return inputData; }
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 ); }