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 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 ); }
/** * Assembles the {@link ViewInterestPoints} object consisting of a list of {@link ViewInterestPointLists} objects for all {@link ViewDescription}s that are present * * @param viewDescriptions - the view description map * */ public void createViewInterestPoints( final Map< ViewId, ViewDescription > viewDescriptions ) { for ( final ViewDescription viewDescription : viewDescriptions.values() ) if ( viewDescription.isPresent() ) interestPointCollectionLookup.put( viewDescription, new ViewInterestPointLists( viewDescription.getTimePointId(), viewDescription.getViewSetupId() ) ); } }
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; }
protected ViewId getViewSelection( final String dialogHeader, final String text ) { final ArrayList< ViewDescription > views = SpimData2.getAllViewDescriptionsSorted( spimData, viewIdsToProcess ); final String[] viewChoice = new String[ views.size() ]; for ( int i = 0; i < views.size(); ++i ) { final ViewDescription vd = views.get( i ); viewChoice[ i ] = "Timepoint " + vd.getTimePointId() + ", ViewSetupId " + vd.getViewSetupId(); } if ( defaultViewChoice >= views.size() ) defaultViewChoice = 0; final GenericDialog gd = new GenericDialog( dialogHeader ); gd.addMessage( text ); gd.addChoice( "View", viewChoice, viewChoice[ defaultViewChoice ] ); gd.showDialog(); if ( gd.wasCanceled() ) return null; final ViewId viewId = views.get( defaultViewChoice = gd.getNextChoiceIndex() ); return viewId; }
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 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 < 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 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(); } } } } }
viewId.getTimePointId(), viewId.getViewSetupId() ); if ( !vd.isPresent() ) continue; ViewSetup setup = vd.getViewSetup(); " timepoint: " + vd.getTimePoint().getName() + " angle: " + vd.getViewSetup().getAngle().getName() + " channel: " + vd.getViewSetup().getChannel().getName() + " illum: " + vd.getViewSetup().getIllumination().getName() ); " timepoint: " + vd.getTimePoint().getName() + " angle: " + vd.getViewSetup().getAngle().getName() + " channel: " + vd.getViewSetup().getChannel().getName() + " illum: " + vd.getViewSetup().getIllumination().getName() );
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; }
downsampleXY = DownsampleTools.downsampleFactor( downsampleXYIndex, downsampleZ, viewDescription.getViewSetup().getVoxelSize() ); else downsampleXY = downsampleXYIndex; return DisplayImage.getImagePlusInstance( img, false, "tp: " + viewDescription.getTimePoint().getName() + " viewSetup: " + viewDescription.getViewSetupId(), Double.NaN, Double.NaN ); else return DisplayImage.getImagePlusInstance( img, false, "tp: " + viewDescription.getTimePoint().getName() + " viewSetup: " + viewDescription.getViewSetupId(), minIntensity, maxIntensity );
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 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< TimePoint > getAllTimePointsSorted( final Collection< ? extends ViewDescription > vds ) { final HashSet< TimePoint > timepointSet = new HashSet< TimePoint >(); for ( final ViewDescription vd : vds ) if ( vd.isPresent() ) timepointSet.add( vd.getTimePoint() ); final ArrayList< TimePoint > timepoints = new ArrayList< TimePoint >(); timepoints.addAll( timepointSet ); Collections.sort( timepoints, new Comparator< TimePoint >() { @Override public int compare( final TimePoint o1, final TimePoint o2 ) { return o1.getId() - o2.getId(); } }); return timepoints; }
public static double[] determineInputBitDepth( final Group< ViewDescription > group, final SpimData2 spimData, final RandomAccessibleInterval< FloatType > virtual ) { SetupImgLoader< ? > loader = spimData.getSequenceDescription().getImgLoader().getSetupImgLoader( group.iterator().next().getViewSetupId() ); Object type = loader.getImageType(); if ( UnsignedByteType.class.isInstance( type ) ) return new double[] { 0, 255 }; else if ( UnsignedShortType.class.isInstance( type ) ) return new double[] { 0, 65535 }; else { IOFunctions.println( "WARNING: You are saving a non-8/16 bit input as 16bit, have to manually determine min/max of the fused image." ); final float[] minmax = FusionTools.minMax( virtual ); return new double[]{ minmax[ 0 ], minmax[ 1 ] }; } }
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; }
+ "Requesting Img from ImgLoader (tp=" + vd.getTimePointId() + ", setup=" + vd.getViewSetupId() + ")" ); double[][] mipmapResolutions = mrImgLoader.getSetupImgLoader( vd.getViewSetupId() ).getMipmapResolutions(); final int fz = (int)Math.round( mipmapResolutions[ bestLevel ][ 2 ] ); mipMapTransform.set( mrImgLoader.getSetupImgLoader( vd.getViewSetupId() ).getMipmapTransforms()[ bestLevel ] ); input = mrImgLoader.getSetupImgLoader( vd.getViewSetupId() ).getFloatImage( vd.getTimePointId(), bestLevel, false, LOAD_COMPLETELY ); else input = mrImgLoader.getSetupImgLoader( vd.getViewSetupId() ).getFloatImage( vd.getTimePointId(), bestLevel, false ); input = imgLoader.getSetupImgLoader( vd.getViewSetupId() ).getFloatImage( vd.getTimePointId(), false, LOAD_COMPLETELY ); else input = imgLoader.getSetupImgLoader( vd.getViewSetupId() ).getFloatImage( vd.getTimePointId(), false );
System.out.println( "Present: " + vd.isPresent() + " -- " + vd.getTimePointId() + " " + vd.getViewSetupId() );
continue; final VoxelDimensions voxelSize = vd.getViewSetup().getVoxelSize(); IOFunctions.println( new Date( System.currentTimeMillis() ) + ": TP=" + vd.getTimePointId() + " ViewSetup=" + vd.getViewSetupId() + ", Detections: " + oldIpl.getInterestPointsCopy().size() + " >>> " + newIpl.getInterestPointsCopy().size() );