public static SpimData spimdataExample( final int[] angles, final int axis, final int numPoints, final double[] sigma, final Interval range ) { final TimePoints timepoints = LegacySimulatedBeadsImgLoader.createTimepoints(); final ArrayList< ViewSetup > setups = LegacySimulatedBeadsImgLoader.createViewSetups( angles, axis, range ); final MissingViews missingViews = null; final SimulateBeads sb = new SimulateBeads( angles, axis, numPoints, range, range, sigma ); final SequenceDescription sequenceDescription = new SequenceDescription( timepoints, setups, null, missingViews ); final ImgLoader imgLoader = new SimulatedBeadsImgLoader( sb ); sequenceDescription.setImgLoader( imgLoader ); // get the minimal resolution of all calibrations final double minResolution = 1.0; final ViewRegistrations viewRegistrations = LegacySimulatedBeadsImgLoader.createViewRegistrations( sequenceDescription.getViewDescriptions(), minResolution ); // finally create the SpimData itself based on the sequence description and the view registration final SpimData spimData = new SpimData( new File( "" ), sequenceDescription, viewRegistrations ); return spimData; }
public static void testDoM( final SpimData2 spimData ) { DoMParameters dom = new DoMParameters(); dom.imgloader = spimData.getSequenceDescription().getImgLoader(); dom.toProcess = new ArrayList< ViewDescription >(); dom.toProcess.addAll( spimData.getSequenceDescription().getViewDescriptions().values() ); // filter not present ViewIds final List< ViewDescription > removed = SpimData2.filterMissingViews( spimData, dom.toProcess ); IOFunctions.println( new Date( System.currentTimeMillis() ) + ": Removed " + removed.size() + " views because they are not present." ); dom.downsampleXY = 2; dom.radius1 = 2; final HashMap< ViewId, List< InterestPoint > > points = DoM.findInterestPoints( dom ); InterestPointTools.addInterestPoints( spimData, "beads", points, "DoM, sigma=2, downsample=2" ); }
MissingViews m = spimData.getSequenceDescription().getMissingViews(); System.out.println( "Missing: " + view.getTimePointId() + " " + view.getViewSetupId() ); for ( final ViewDescription vd : spimData.getSequenceDescription().getViewDescriptions().values() ) System.out.println( "Present: " + vd.isPresent() + " -- " + vd.getTimePointId() + " " + vd.getViewSetupId() );
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 ); }
SequenceDescription sd = new SequenceDescription( new TimePoints( timePoints ), viewSetups , null, new MissingViews( missingViewIds )); ViewDescription vdI = sd.getViewDescription( k.getA(), k.getB() ); System.out.println( vdI ); if (vdI != null && vdI.isPresent()){ else imgLoader = new FileMapImgLoaderLOCI( fileMap, FileListDatasetDefinitionUtil.selectImgFactory(state.getDimensionMap()), sd, state.getWasZGrouped() ); sd.setImgLoader( imgLoader ); ViewRegistrations vrs = DatasetCreationUtils.createViewRegistrations( sd.getViewDescriptions(), minResolution ); viewInterestPoints.createViewInterestPoints( sd.getViewDescriptions() );
public static List< BoundingBox > getAllBoundingBoxes( final SpimData2 spimData, final Collection< ViewId > currentlySelected, final boolean addBoundingBoxForAllViews ) { final List< BoundingBox > bbs = new ArrayList<>(); bbs.addAll( spimData.getBoundingBoxes().getBoundingBoxes() ); final ArrayList< ViewId > allViews = new ArrayList<>(); if ( currentlySelected != null && currentlySelected.size() > 0 ) { allViews.addAll( currentlySelected ); bbs.add( BoundingBoxTools.maximalBoundingBox( spimData, allViews, "Currently Selected Views" ) ); } if ( addBoundingBoxForAllViews ) { allViews.clear(); allViews.addAll( spimData.getSequenceDescription().getViewDescriptions().values() ); bbs.add( BoundingBoxTools.maximalBoundingBox( spimData, allViews, "All Views" ) ); } return bbs; }
if (gridMoveType == 2) final ArrayList<ViewDescription> vds = new ArrayList<>(data.getSequenceDescription().getViewDescriptions().values()); ((FileMapGettable)data.getSequenceDescription().getImgLoader() ).getFileMap().values().stream().forEach( p -> boolean zSizeEqualInEveryFile = LegacyFileMapImgLoaderLOCI.isZSizeEqualInEveryFile( data, (FileMapGettable)data.getSequenceDescription().getImgLoader() ); zSizeEqualInEveryFile = zSizeEqualInEveryFile && !(data.getSequenceDescription().getAllAnglesOrdered().size() == 1 && data.getSequenceDescription().getAllTilesOrdered().size() == 1); boolean multipleAngles = data.getSequenceDescription().getAllAnglesOrdered().size() > 1; if (multipleAngles) gdSave.addCheckbox( "apply_angle_rotation", true ); LegacyFileMapImgLoaderLOCI.checkAndRemoveZeroVolume( data, (ImgLoader & FileMapGettable) data.getSequenceDescription().getImgLoader(), zVariables.size() > 0 ); IOFunctions.println( new Date( System.currentTimeMillis() ) + ": Finished." ); final ArrayList<ViewDescription> vds = new ArrayList<>(data.getSequenceDescription().getViewDescriptions().values()); if (resaveAsHDF5) final Map< Integer, ExportMipmapInfo > perSetupExportMipmapInfo = Resave_HDF5.proposeMipmaps( data.getSequenceDescription().getViewSetupsOrdered() ); final int firstviewSetupId = data.getSequenceDescription().getViewSetupsOrdered().get( 0 ).getId(); Generic_Resave_HDF5.lastExportPath = String.join( File.separator, chosenPath.getAbsolutePath(), "dataset"); final Parameters params = Generic_Resave_HDF5.getParameters( perSetupExportMipmapInfo.get( firstviewSetupId ), true, true ); net.preibisch.mvrecon.fiji.ImgLib2Temp.Pair< SpimData2, List< String > > result = Resave_HDF5.createXMLObject( data, new ArrayList<>(data.getSequenceDescription().getViewDescriptions().keySet()), params, progressWriter, true );
final Map< Integer, ViewSetup > viewSetups = (Map< Integer, ViewSetup >)sequenceDescription.getViewSetups(); for ( final TimePoint t : spimData.getSequenceDescription().getTimePoints().getTimePointsOrdered() ) MissingViews m = spimData.getSequenceDescription().getMissingViews(); if ( m != null ) newMissingViews.addAll( m.getMissingViews() ); BasicViewDescription.markMissingViews( spimData.getSequenceDescription().getViewDescriptions(), m ); 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();
.getImgLoader() instanceof FlatfieldCorrectionWrappedImgLoader< ? > ); data.getSequenceDescription().getViewDescriptions().keySet(), Illumination.class ); final ArrayList< Channel > channels = SpimData2.getAllInstancesOfEntitySorted( data, data.getSequenceDescription().getViewDescriptions().keySet(), Channel.class ); ? ( (FlatfieldCorrectionWrappedImgLoader< ? >) data.getSequenceDescription().getImgLoader() ) .isActive() : true ); gdp.addCheckbox( "cache_corrected_images", alreadyFF ? ( (FlatfieldCorrectionWrappedImgLoader< ? >) data.getSequenceDescription().getImgLoader() ) .isCached() : true ); if ( alreadyFF ) fileMap = ( (LazyLoadingFlatFieldCorrectionMap< ImgLoader >) data.getSequenceDescription() .getImgLoader() ).getFileMap(); ViewId anyViewId = data.getSequenceDescription().getViewDescriptions().values().stream() .filter( vd -> { return vd.getViewSetup().getChannel() == c if ( alreadyFF ) ffIL = (FlatfieldCorrectionWrappedImgLoader< ImgLoader >) data.getSequenceDescription() .getImgLoader(); else if ( data.getSequenceDescription().getImgLoader() instanceof MultiResolutionImgLoader ) ffIL = new MultiResolutionFlatfieldCorrectionWrappedImgLoader( (MultiResolutionImgLoader) data.getSequenceDescription().getImgLoader(), cache ); else
public static boolean isImgLoaderVirtual( final SpimData spimData ) { if ( MultiResolutionImgLoader.class.isInstance( spimData.getSequenceDescription().getImgLoader() ) ) return true; // TODO: check for Davids virtual implementation of the normal imgloader return false; }
final Dimensions dim = spimData.getSequenceDescription().getViewDescription( viewId ).getViewSetup().getSize(); final ViewRegistration vr = spimData.getViewRegistrations().getViewRegistration( viewId ); vr.updateModel(); registrations.put( viewId, model ); dimensions.put( viewId, ViewSetupUtils.getSizeOrLoad( viewId.getViewSetup(), viewId.getTimePoint(), spimData.getSequenceDescription().getImgLoader() ) ); final ImgLoader imgLoader = spimData.getSequenceDescription().getImgLoader(); final Map< ViewId, ViewDescription > viewDescriptions = spimData.getSequenceDescription().getViewDescriptions();
if (Hdf5ImageLoader.class.isInstance( spimData.getSequenceDescription().getImgLoader() )) il = ( Hdf5ImageLoader ) spimData.getSequenceDescription().getImgLoader(); else return false; Hdf5ImageLoader newLoader = new Hdf5ImageLoader( new File( mergedHdfFilename ), mergedPartitions, seq, false ); seq.setImgLoader( newLoader ); WriteSequenceToHdf5.writeHdf5PartitionLinkFile( spimData.getSequenceDescription(), perSetupExportMipmapInfo );
public static SpimData createSpimData( int numPoints, double[] sigma, Interval rangeSimulation, Interval intervalRender, int rotAxis, double[] ratations, List<double[]> channelShifts, List<double[]> illumShifts, List<double[]> timeShifts, List<double[]> tileShifts, double relativeTileError, boolean centerAngles ) { SimulateBeads2 sb = new SimulateBeads2( numPoints, sigma, rangeSimulation, intervalRender ); SimulatedBeadsImgLoader2 loader = new SimulatedBeadsImgLoader2( sb, rotAxis, ratations, channelShifts, illumShifts, timeShifts, tileShifts ); SequenceDescription sd = new SequenceDescription( createTimePointsFromImgLoader( loader ), createViewSetupsFromImgLoader( loader ), null, new MissingViews( new ArrayList<>() ) ); sd.setImgLoader( loader ); SpimData res = new SpimData( new File(""), sd, createViewRegistrationsFromImgLoader( loader, relativeTileError, centerAngles ) ); return res; }
String question; final boolean notAllSelected = viewIds.size() < data.getSequenceDescription().getViewDescriptions().size(); data.getSequenceDescription().getViewDescriptions().size() + " views for export.\n" + "(the rest will not be visible in the new dataset - except they are missing)\n"; viewIds.addAll( data.getSequenceDescription().getViewDescriptions().keySet() ); if ( AbstractImgFactoryImgLoader.class.isInstance( data.getSequenceDescription().getImgLoader() ) ) params.imgFactory = ( (AbstractImgFactoryImgLoader)data.getSequenceDescription().getImgLoader() ).getImgFactory(); else if ( MicroManagerImgLoader.class.isInstance( data.getSequenceDescription().getImgLoader() ) ) params.imgFactory = new ArrayImgFactory< FloatType >(); else final int firstviewSetupId = data.getSequenceDescription().getViewSetupsOrdered().get( 0 ).getId(); final ExportMipmapInfo autoMipmapSettings = perSetupExportMipmapInfo.get( firstviewSetupId );
views.add( new ViewId( viewId.getTimePointId(), viewId.getViewSetupId() ) ); final MissingViews oldMissingViews = oldSpimData.getSequenceDescription().getMissingViews(); final HashSet< ViewId > missingViews = new HashSet< ViewId >(); final SequenceDescription sequenceDescription = new SequenceDescription( timepoints, viewSetupsToProcess, oldSpimData.getSequenceDescription().getImgLoader(), new MissingViews( missingViews ) );
timepointNames[ i ] = result.getTimePointsToProcess().get( i ).getName(); final List< Angle > angles = result.getData().getSequenceDescription().getAllAnglesOrdered(); final String[] angleNames = new String[ angles.size() ]; for ( int i = 0; i < angles.size(); ++i ) angleNames[ i ] = angles.get( i ).getName(); final List< Channel > channels = result.getData().getSequenceDescription().getAllChannelsOrdered(); final String[] channelNames = new String[ channels.size() ]; for ( int i = 0; i < channels.size(); ++i ) channelNames[ i ] = channels.get( i ).getName(); final List< Illumination > illuminations = result.getData().getSequenceDescription().getAllIlluminationsOrdered(); final String[] illuminationNames = new String[ illuminations.size() ]; for ( int i = 0; i < illuminations.size(); ++i ) illuminationNames[ i ] = illuminations.get( i ).getName(); final List< Tile > tiles = result.getData().getSequenceDescription().getAllTilesOrdered(); final String[] tileNames = new String[ tiles.size() ]; for ( int i = 0; i < tiles.size(); ++i ) final ViewDescription viewDescription = result.getData().getSequenceDescription().getViewDescription( viewId.getTimePointId(), viewId.getViewSetupId() );
public static SpimData2 createDataset( final String file, final StackListParameters params ) { ImgFactory< ? extends NativeType< ? > > imgFactory = null; switch( params.container ) { case ArrayImg: imgFactory = new ArrayImgFactory< FloatType >(); break; case CellImg: imgFactory = new CellImgFactory< FloatType >( 256 ); break; } // assemble timepints, viewsetups, missingviews and the imgloader final SequenceDescription sequenceDescription = createSequenceDescription( params.timepoints, params.channels, params.illuminations, params.angles, params.tiles, loadCalibration(new File(file)) ); final ImgLoader imgLoader = createAndInitImgLoader( ".", new File( params.directory ), imgFactory, sequenceDescription, params ); sequenceDescription.setImgLoader( imgLoader ); // get the minimal resolution of all calibrations final double minResolution = DatasetCreationUtils.minResolution( sequenceDescription, sequenceDescription.getViewDescriptions().values() ); IOFunctions.println( "Minimal resolution in all dimensions over all views is: " + minResolution ); IOFunctions.println( "(The smallest resolution in any dimension; the distance between two pixels in the output image will be that wide)" ); // create the initial view registrations (they are all the identity transform) final ViewRegistrations viewRegistrations = createViewRegistrations( sequenceDescription.getViewDescriptions(), minResolution ); // create the initial view interest point object final ViewInterestPoints viewInterestPoints = new ViewInterestPoints(); viewInterestPoints.createViewInterestPoints( sequenceDescription.getViewDescriptions() ); // finally create the SpimData itself based on the sequence description and the view registration final SpimData2 spimData = new SpimData2( new File( params.directory ), sequenceDescription, viewRegistrations, viewInterestPoints, new BoundingBoxes(), new PointSpreadFunctions(), new StitchingResults(), new IntensityAdjustments() ); return spimData; }
final SequenceDescription sequenceDescription = new SequenceDescription( timepoints, viewSetupsToProcess, null, missingViews ); for ( final ViewDescription vDesc : sequenceDescription.getViewDescriptions().values() )
for ( final ViewSetup v : data.getSequenceDescription().getViewSetupsOrdered() ) final ViewSetup vOut = dataOut.getSequenceDescription().getViewSetups().get( v.getId() ); for ( final TimePoint tp : data.getSequenceDescription().getTimePoints().getTimePointsOrdered() ) for ( final ViewSetup vs : data.getSequenceDescription().getViewSetupsOrdered() ) final ViewDescription vd = data.getSequenceDescription().getViewDescription( tp.getId(), vs.getId() );
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; }