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; }
filename, params.imgFactory, layoutTP, layoutChannels, layoutIllum, layoutAngles, layoutTiles, newSpimData.getSequenceDescription() ); newSpimData.getSequenceDescription().setImgLoader( imgLoader );
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; }
@Override public boolean finish() { final FileMapImgLoaderLOCI imgLoader = new FileMapImgLoaderLOCI( fileMap, new CellImgFactory<>(), newSpimData.getSequenceDescription() ); newSpimData.getSequenceDescription().setImgLoader( imgLoader ); XmlIoSpimData2 io = new XmlIoSpimData2( "" ); try { io.save( newSpimData, new File( params.getXMLFile() ).getAbsolutePath() ); IOFunctions.println( "(" + new Date( System.currentTimeMillis() ) + "): Saved xml '" + io.lastFileName() + "'." ); // this spimdata object was not modified, we just wrote a new one return false; } catch ( SpimDataException e ) { IOFunctions.println( "(" + new Date( System.currentTimeMillis() ) + "): Could not save xml '" + io.lastFileName() + "'." ); e.printStackTrace(); return false; } }
public static Pair< SpimData2, List< String > > createXMLObject( final SpimData2 spimData, final List< ViewId > viewIds, final Parameters params, final ProgressWriter progressWriter, final boolean useRightAway ) { // Re-assemble a new SpimData object containing the subset of viewsetups and timepoints selected final List< String > filesToCopy = new ArrayList< String >(); final SpimData2 newSpimData = Resave_TIFF.assemblePartialSpimData2( spimData, viewIds, params.seqFile.getParentFile(), filesToCopy ); final ArrayList< Partition > partitions = Generic_Resave_HDF5.getPartitions( newSpimData, params ); final Hdf5ImageLoader hdf5Loader; if ( useRightAway ) hdf5Loader = new Hdf5ImageLoader( params.hdf5File, partitions, newSpimData.getSequenceDescription(), true ); else hdf5Loader = new Hdf5ImageLoader( params.hdf5File, partitions, null, false ); newSpimData.getSequenceDescription().setImgLoader( hdf5Loader ); newSpimData.setBasePath( params.seqFile.getParentFile() ); return new ValuePair< SpimData2, List< String > >( newSpimData, filesToCopy ); } }
Hdf5ImageLoader newLoader = new Hdf5ImageLoader( new File( mergedHdfFilename ), mergedPartitions, seq, false ); seq.setImgLoader( newLoader ); WriteSequenceToHdf5.writeHdf5PartitionLinkFile( spimData.getSequenceDescription(), perSetupExportMipmapInfo );
else imgLoader = new FileMapImgLoaderLOCI( fileMap, FileListDatasetDefinitionUtil.selectImgFactory(state.getDimensionMap()), sd, state.getWasZGrouped() ); sd.setImgLoader( imgLoader );
sequenceDescription.setImgLoader( imgLoader );
seq.setImgLoader( new Hdf5ImageLoader( params.getHDF5File(), hdf5Partitions, seq, false ) ); SpimData2 spimData = new SpimData2( basePath, seq, viewRegistrations, viewsInterestPoints, new BoundingBoxes(), new PointSpreadFunctions(), new StitchingResults(), new IntensityAdjustments() );
sequenceDescription.setImgLoader( imgLoader );
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; }
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; }
ffIL.setCached( cache ); data.getSequenceDescription().setImgLoader( ffIL ); gdp.dispose();
sequenceDescription.setImgLoader( imgLoader );
public static void main(String[] args) { GenericLoadParseQueryXML< SpimData2, SequenceDescription, ViewSetup, ViewDescription, ImgLoader, XmlIoSpimData2 > lpq = new GenericLoadParseQueryXML<>( new XmlIoSpimData2( "" ) ); lpq.queryXML(); SpimData2 data = lpq.getData(); // this will crash if il is not multires MultiResolutionImgLoader il = (MultiResolutionImgLoader) data.getSequenceDescription().getImgLoader(); MultiResolutionFlatfieldCorrectionWrappedImgLoader ffcil = new MultiResolutionFlatfieldCorrectionWrappedImgLoader( il ); ffcil.setDarkImage( new ViewId( 0, 0 ), new File( "/Users/david/desktop/ff.tif" ) ); data.getSequenceDescription().setImgLoader( ffcil ); new ImageJ(); RandomAccessibleInterval< FloatType > image = ( (MultiResolutionImgLoader) data.getSequenceDescription() .getImgLoader() ).getSetupImgLoader( 0 ).getFloatImage( 0, 1, false ); ImageJFunctions.show( image ); }
public static void main(String[] args) { GenericLoadParseQueryXML< SpimData2, SequenceDescription, ViewSetup, ViewDescription, ImgLoader, XmlIoSpimData2 > lpq = new GenericLoadParseQueryXML<>( new XmlIoSpimData2( "" ) ); lpq.queryXML(); SpimData2 data = lpq.getData(); ImgLoader il = data.getSequenceDescription().getImgLoader(); DefaultFlatfieldCorrectionWrappedImgLoader ffcil = new DefaultFlatfieldCorrectionWrappedImgLoader( il ); ffcil.setDarkImage( new ViewId( 0, 0 ), new File( "/Users/david/desktop/ff.tif" ) ); data.getSequenceDescription().setImgLoader( ffcil ); new ImageJ(); RandomAccessibleInterval< FloatType > image = data.getSequenceDescription().getImgLoader() .getSetupImgLoader( 0 ).getFloatImage( 0, false ); RandomAccessibleInterval< FloatType > downsampleBlock = MultiResolutionFlatfieldCorrectionWrappedImgLoader .downsampleHDF5( image, new int[] { 3, 3, 2 } ); ImageJFunctions.show( downsampleBlock, "" ); }
sequenceDescription.setImgLoader( imgLoader );
sequenceDescription.setImgLoader( imgLoader );
meta.getPhaseChannelId(), sequenceDescription ); sequenceDescription.setImgLoader( imgLoader );