public static ArrayList< ViewSetup> getAllViewSetups( final Collection< ? extends ViewDescription > vds ) { final HashSet< ViewSetup > set = new HashSet< ViewSetup >(); for ( final ViewDescription vd : vds ) if ( vd.isPresent() ) set.add( vd.getViewSetup() ); final ArrayList< ViewSetup > setups = new ArrayList< ViewSetup >(); setups.addAll( set ); Collections.sort( setups ); return setups; }
public static String getTitle( final int splittingType, final Group< ViewDescription > group ) { String title; final ViewDescription vd0 = group.iterator().next(); if ( splittingType == 0 ) // "Each timepoint & channel" title = "fused_tp_" + vd0.getTimePointId() + "_ch_" + vd0.getViewSetup().getChannel().getId(); else if ( splittingType == 1 ) // "Each timepoint, channel & illumination" title = "fused_tp_" + vd0.getTimePointId() + "_ch_" + vd0.getViewSetup().getChannel().getId() + "_illum_" + vd0.getViewSetup().getIllumination().getId(); else if ( splittingType == 2 ) // "All views together" title = "fused"; else // "All views" title = "fused_tp_" + vd0.getTimePointId() + "_vs_" + vd0.getViewSetupId(); return title; }
public void add( final ViewDescription vd ) { if ( vd == null ) return; this.ts.add( vd.getTimePoint() ); this.cs.add( vd.getViewSetup().getChannel() ); this.is.add( vd.getViewSetup().getIllumination() ); this.as.add( vd.getViewSetup().getAngle() ); this.vds.add( vd ); }
public 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 ); }
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; }
private static final void locationForViewDescription( final int[] l, final ViewDescription vd, final HashMap< TimePoint, Integer > mapT, final HashMap< Channel, Integer > mapC, final HashMap< Illumination, Integer > mapI, final HashMap< Angle, Integer > mapA ) { final TimePoint t = vd.getTimePoint(); final Channel c = vd.getViewSetup().getChannel(); final Illumination i = vd.getViewSetup().getIllumination(); final Angle a = vd.getViewSetup().getAngle(); l[ 0 ] = mapA.get( a ); l[ 1 ] = mapI.get( i ); l[ 2 ] = mapC.get( c ); l[ 3 ] = mapT.get( t ); }
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; }
@Override public int compare(Group< ViewDescription > o1, Group< ViewDescription > o2) { if (o1.size() == 0) return -o2.size(); return o1.getViews().iterator().next().getViewSetup().getTile().getId() - o2.getViews().iterator().next().getViewSetup().getTile().getId(); } } );
public static long maxNumInputPixelsPerInputGroup( final SpimData2 spimData, final List< ViewId > views, final int splittingType ) { long maxNumPixels = 0; for ( final Group< ViewDescription > group : getFusionGroups( spimData, views, splittingType ) ) { long numpixels = 0; for ( final ViewDescription vd : group ) numpixels += Intervals.numElements( vd.getViewSetup().getSize() ); maxNumPixels = Math.max( maxNumPixels, numpixels ); } return maxNumPixels; }
protected String nameForGroup( final Group< ViewDescription > group ) { final ViewDescription vd1 = group.iterator().next(); String name = "TP=" + vd1.getTimePointId() + " Angle=" + vd1.getViewSetup().getAngle().getName() + " Channel=" + vd1.getViewSetup().getChannel().getName(); if ( !groupIllums ) name += " Illum=" + vd1.getViewSetup().getChannel().getName(); if ( !groupTiles ) name += " Tile=" + vd1.getViewSetup().getTile().getName(); return name; }
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; }
@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 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 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 ] ) ); } }