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; }
/** * Updates one specific ViewSetup using the imageMetaDataCache * * @param setup - {@link ViewSetup}s that can potentially be updated if it is in the cache * @param forceUpdate - overwrite the data if it is already present * @return true if something was updated, false if it was not in the cache or if could have been updated but was already there */ public boolean updateXMLMetaData( final ViewSetup setup, final boolean forceUpdate ) { boolean updated = false; if ( viewIdLookUp.containsKey( setup.getId() ) ) { // look up the metadata using the ViewId linked by the ViewSetupId final Pair< Dimensions, VoxelDimensions > metaData = imageMetaDataCache.get( viewIdLookUp.get( setup.getId() ) ); if ( !setup.hasSize() || forceUpdate ) { setup.setSize( metaData.getA() ); updated = true; } if ( !setup.hasVoxelSize() || forceUpdate ) { setup.setVoxelSize( metaData.getB() ); updated = true; } } return updated; }
public static void main( String args[] ) { new ImageJ(); IOFunctions.printIJLog = true; final LoadParseQueryXML lpq = new LoadParseQueryXML(); final ArrayList< String > queryFor = new ArrayList< String >(); queryFor.add( "Timepoint" ); queryFor.add( "channel" ); queryFor.add( "angle" ); queryFor.add( "Tile" ); queryFor.add( "illumination" ); lpq.queryXML( true, true, true, true, true ); for ( final TimePoint i : lpq.getTimePointsToProcess() ) System.out.println( i.getId() ); for ( final ViewSetup v : lpq.getViewSetupsToProcess() ) { System.out.println( v.getId() + " " + v.getAngle().getName() + " " + v.getChannel().getName() + " " + v.getIllumination().getName() ); } } }
final int firstviewSetupId = newViewSetups.get( 0 ).getId(); params = Generic_Resave_HDF5.getParameters( perSetupExportMipmapInfo.get( firstviewSetupId ), true, getDescription(), is16bit );
/** * @param seqDesc the sequence description * @param t - the timepoint * @param c - the channel * @param a - the angle * @param i - the illumination * @param x - the tile * @return - the ViewId that fits to timepoint, angle, channel & illumination by ID (or null if it does not exist) */ public static ViewId getViewId( final SequenceDescription seqDesc, final TimePoint t, final Channel c, final Angle a, final Illumination i, final Tile x ) { final ViewSetup viewSetup = getViewSetup( seqDesc.getViewSetupsOrdered(), c, a, i, x ); if ( viewSetup == null ) return null; else return new ViewId( t.getId(), viewSetup.getId() ); }
final int firstviewSetupId = newViewSetups.get( 0 ).getId(); params = Generic_Resave_HDF5.getParameters( perSetupExportMipmapInfo.get( firstviewSetupId ), false, getDescription(), is16bit ); if ( params == null )
/** * find ViewSetup index corresponding to given (angle, illumination, * channel) triple. * * @return setup index or -1 if no corresponding setup was found. */ protected static int getViewSetupId( final ArrayList< ViewSetup > setups, final int angle, final int illumination, final int channel ) { for ( final ViewSetup s : setups ) if ( s.getAngle().getId() == angle && s.getIllumination().getId() == illumination && s.getChannel().getId() == channel ) return s.getId(); return -1; }
viewSetups.put( vs.getId(), vs ); newMissingViews.add( new ViewId( t.getId(), newSetup.getId() ) ); ips.put( new ViewId( t.getId(), newSetup.getId() ), new ViewInterestPointLists( t.getId(), newSetup.getId() ) ); for ( final ViewSetup vs : newViewSetups ) final ViewDescription vd = sequenceDescription.getViewDescription( tp.getId(), vs.getId() ); final ViewRegistration viewRegistration = new ViewRegistration( vd.getTimePointId(), vd.getViewSetupId() ); viewRegistration.identity();
final HashMap< Integer, Integer > setupIdSequenceToPartition = new HashMap< Integer, Integer >(); for ( final ViewSetup setup : newViewSetups ) setupIdSequenceToPartition.put( setup.getId(), setup.getId() ); final Partition partition = new Partition( params.getHDF5File().getAbsolutePath(), timepointIdSequenceToPartition, setupIdSequenceToPartition ); for ( final ViewDescription vDesc : seq.getViewDescriptions().values() )
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; }
for ( final ViewSetup v : viewSetupsToProcess ) final ViewId viewId = new ViewId( t.getId(), v.getId() );
final ViewSetup vOut = dataOut.getSequenceDescription().getViewSetups().get( v.getId() ); "Could not find corresponding ViewSetupId=" + v.getId() + " in xml '" + xmls.get( i ) + "'" ); for ( final ViewSetup vs : data.getSequenceDescription().getViewSetupsOrdered() ) final ViewDescription vd = data.getSequenceDescription().getViewDescription( tp.getId(), vs.getId() ); final ViewInterestPointLists vipl = vip.getViewInterestPointLists( tp.getId(), vs.getId() ); final ViewInterestPointLists viplOut = vipOut.getViewInterestPointLists( tp.getId(), vs.getId() );
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 int firstviewSetupId = xml.getData().getSequenceDescription().getViewSetupsOrdered().get( 0 ).getId(); final Parameters params = Generic_Resave_HDF5.getParameters( perSetupExportMipmapInfo.get( firstviewSetupId ), true, true );
vs.getId(), vs.getName(), fusion.getDownsampledBoundingBox(),
newViewSetupId = Math.max( vs.getId(), newViewSetupId ); newTileId = Math.max( vs.getTile().getId(), newTileId ); newChannelId = Math.max( vs.getChannel().getId(), newChannelId );
for (ViewSetup setup : setups) Dimensions siz = imgLoader.getSetupImgLoader( setup.getId() ).getImageSize( tp.getId() ); setup.setSize( siz );
final int firstviewSetupId = xml.getData().getSequenceDescription().getViewSetupsOrdered().get( 0 ).getId(); ExportMipmapInfo autoMipmapSettings = perSetupExportMipmapInfo.get( firstviewSetupId );