/** * 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< 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 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; }
if ( vd1.getTimePointId() == vd2.getTimePointId() && vd1.getViewSetup().getChannel().getId() != vd2.getViewSetup().getChannel().getId() )
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; }
@Override public void run() { if ( ip.wasCanceled() ) return; final List< InterestPoint > ipList = ip.getInterestPointList(); if ( ipList.size() == 0 ) { IOFunctions.println( "No detections remaining. Quitting." ); return; } // add new label final InterestPointList newIpl = new InterestPointList( lists.getInterestPointList( label ).getBaseDir(), new File( lists.getInterestPointList( label ).getFile().getParentFile(), "tpId_" + vd.getTimePointId() + "_viewSetupId_" + vd.getViewSetupId() + "." + newLabel ) ); newIpl.setInterestPoints( ipList ); newIpl.setCorrespondingInterestPoints( new ArrayList<>() ); newIpl.setParameters( "manually removed detections from '" +label + "'" ); lists.addInterestPointList( newLabel, newIpl ); } }) );
System.out.println( "Present: " + vd.isPresent() + " -- " + vd.getTimePointId() + " " + vd.getViewSetupId() );
IOFunctions.println( new Date( System.currentTimeMillis() ) + ": TP=" + vd.getTimePointId() + " ViewSetup=" + vd.getViewSetupId() + ", Detections: " + oldIpl.getInterestPointsCopy().size() + " >>> " + newIpl.getInterestPointsCopy().size() );
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 ); }
regMap.put( vDesc, new ViewRegistration( vDesc.getTimePointId(), vDesc.getViewSetupId() ) ); final ViewRegistrations viewRegistrations = new ViewRegistrations( regMap );
if ( viewDescription.isPresent() ) final ViewRegistration viewRegistration = new ViewRegistration( viewDescription.getTimePointId(), viewDescription.getViewSetupId() );
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; }
RandomAccessibleInterval< FloatType > img = spimData.getSequenceDescription().getImgLoader().getSetupImgLoader( vd.getViewSetupId() ).getFloatImage( vd.getTimePointId(), false );
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; }
final ViewRegistration viewRegistration = new ViewRegistration( vDesc.getTimePointId(), vDesc.getViewSetupId() ); viewRegistration.identity(); regMap.put( viewRegistration, viewRegistration );
public static < T extends RealType< T > & NativeType< T > > boolean maxProject( final List< ? extends ViewDescription > vds, final ImgLoader imgLoader, final T type ) { Collections.sort( vds ); final ArrayList< TimePoint > tps = SpimData2.getAllTimePointsSorted( vds ); final ArrayList< ViewSetup > setups = SpimData2.getAllViewSetups( vds ); for ( final ViewSetup setup : setups ) { ImageStack stack = null; for ( final TimePoint t : tps ) for ( final ViewDescription vd : vds ) if ( vd.getTimePointId() == t.getId() && vd.getViewSetupId() == setup.getId() ) { IOFunctions.println( "(" + new Date( System.currentTimeMillis() ) + "): Loading image for timepoint " + t.getId() + " viewsetup " + vd.getViewSetupId() ); final RandomAccessibleInterval< T > img = getImage( type, imgLoader, vd, false ); final FloatProcessor fp = toProcessor( PSFCombination.computeMaxProjection( img, new ArrayImgFactory< T >(), 2, true ) ); if ( stack == null ) stack = new ImageStack( fp.getWidth(), fp.getHeight() ); stack.addSlice( "Timepoint=" + t.getId(), fp); } final ImagePlus imp = new ImagePlus( "ViewSetupId=" + setup.getId(), stack ); imp.setDimensions( 1, 1, stack.getSize() ); imp.show(); } return true; }
final ViewRegistration viewRegistration = new ViewRegistration( vd.getTimePointId(), vd.getViewSetupId() ); viewRegistration.identity(); regMap.put( vd, viewRegistration );
final String name = "TPId" + vd.getTimePointId() + "_SetupId" + vd.getViewSetupId() + "+(label='" + label + "')"; final Interval interval; final RandomAccessibleInterval< UnsignedShortType > img = ( RandomAccessibleInterval< UnsignedShortType > ) spimData.getSequenceDescription().getImgLoader().getSetupImgLoader( vd.getViewSetupId() ).getImage( vd.getTimePointId() ); di.exportImage( img, name ); interval = img;
if ( viewDescription.isPresent() ) final ViewRegistration viewRegistration = new ViewRegistration( viewDescription.getTimePointId(), viewDescription.getViewSetupId() ); final VoxelDimensions voxelSize = viewDescription.getViewSetup().getVoxelSize();
public static boolean loadDimensions( final SpimData2 spimData, final List< ViewSetup > viewsetups ) { boolean loadedDimensions = false; for ( final ViewSetup vs : viewsetups ) { if ( vs.getSize() == null ) { IOFunctions.println( "Dimensions of viewsetup " + vs.getId() + " unknown. Loading them ... " ); for ( final TimePoint t : spimData.getSequenceDescription().getTimePoints().getTimePointsOrdered() ) { final ViewDescription vd = spimData.getSequenceDescription().getViewDescription( t.getId(), vs.getId() ); if ( vd.isPresent() ) { Dimensions dim = spimData.getSequenceDescription().getImgLoader().getSetupImgLoader( vd.getViewSetupId() ).getImageSize( vd.getTimePointId() ); IOFunctions.println( "Dimensions: " + dim.dimension( 0 ) + "x" + dim.dimension( 1 ) + "x" + dim.dimension( 2 ) + ", loaded from tp:" + t.getId() + " vs: " + vs.getId() ); vs.setSize( dim ); loadedDimensions = true; break; } else { IOFunctions.println( "ViewSetup: " + vs.getId() + " not present in timepoint: " + t.getId() ); } } } } return loadedDimensions; }