/** * Split the sequence represented in <code>aggregator</code> into * partitions. * * @param aggregator * represents the full dataset. * @param timepointsPerPartition * how many timepoints should each partition contain (if this is * ≤0, put do not split timepoints across partitions). * @param setupsPerPartition * how many setups should each partition contain (if this is * ≤0, put do not split setups across partitions). * @param xmlFilename * path to the xml file to which the sequence will be saved. This * is used to generate paths for the partitions. * @return list of partitions. */ public static ArrayList< Partition > split( final SetupAggregator aggregator, final int timepointsPerPartition, final int setupsPerPartition, final String xmlFilename ) { final String basename = xmlFilename.endsWith( ".xml" ) ? xmlFilename.substring( 0, xmlFilename.length() - 4 ) : xmlFilename; return Partition.split( aggregator.timepoints.getTimePointsOrdered(), aggregator.setups, timepointsPerPartition, setupsPerPartition, basename ); }
protected static String[] assembleTimepoints( final TimePoints timepoints ) { final String[] tps = new String[ timepoints.size() ]; for ( int t = 0; t < tps.length; ++t ) tps[ t ] = timepoints.getTimePointsOrdered().get( t ).getName(); return tps; }
public static boolean setReferenceTimepoint( final TimePoints timepoints, final int referenceTimePoint ) { final TimePoint ref = timepoints.getTimePoints().get( referenceTimePoint ); if ( ref != null ) { final List< TimePoint > tps = timepoints.getTimePointsOrdered(); for ( int tp = 0; tp < tps.size(); ++tp ) { if ( tps.get( tp ).getId() == referenceTimePoint ) { Interest_Point_Registration.defaultReferenceTimepointIndex = tp; return true; } } } return false; }
protected boolean queryDetails() { // all attibutes this.attributeInstancesToProcess = new HashMap< String, List< Entity > >(); for ( int attributeIndex = 0; attributeIndex < this.attributes.size(); ++attributeIndex ) this.attributeInstancesToProcess.put( this.attributes.get( attributeIndex ), new ArrayList< Entity >() ); for ( int i = 0; i < this.attributes.size(); ++i ) { final String attribute = this.attributes.get( i ); final int choice = attributeChoice.containsKey( attribute ) ? attributeChoice.get( attribute ) : 0; if ( !query( choice, attribute, this.allAttributeInstances.get( attribute ), this.attributeInstancesToProcess.get( attribute ) ) ) return false; } // timepoints this.timepointsToProcess = new ArrayList< TimePoint >(); final String attribute = XmlKeys.TIMEPOINTS_TIMEPOINT_TAG; final int choice = attributeChoice.containsKey( attribute ) ? attributeChoice.get( attribute ) : 0; if ( !query( choice, attribute, this.data.getSequenceDescription().getTimePoints().getTimePointsOrdered(), this.timepointsToProcess ) ) return false; return true; }
public static ArrayList< Partition > getPartitions( final AbstractSpimData< ? > spimData, final Parameters params ) { final AbstractSequenceDescription< ?, ?, ? > seq = spimData.getSequenceDescription(); if ( params.split ) { final String xmlFilename = params.seqFile.getAbsolutePath(); final String basename = xmlFilename.endsWith( ".xml" ) ? xmlFilename.substring( 0, xmlFilename.length() - 4 ) : xmlFilename; List< TimePoint > timepoints = seq.getTimePoints().getTimePointsOrdered(); List< ? extends BasicViewSetup > setups = seq.getViewSetupsOrdered(); return Partition.split( timepoints, setups, params.timepointsPerPartition, params.setupsPerPartition, basename ); } else return null; }
public static int getBDVTimePointIndex(final TimePoint t, final AbstractSpimData< ? > data) { final List< TimePoint > list = data.getSequenceDescription().getTimePoints().getTimePointsOrdered(); for ( int i = 0; i < list.size(); ++i ) if ( list.get( i ).getId() == t.getId() ) return i; return 0; }
public static int getBDVTimePointIndex( final TimePoint t, final AbstractSpimData< ? > data ) { final List< TimePoint > list = data.getSequenceDescription().getTimePoints().getTimePointsOrdered(); for ( int i = 0; i < list.size(); ++i ) if ( list.get( i ).getId() == t.getId() ) return i; return 0; }
public static <AS extends AbstractSpimData<?> > void applyToSpimData( AS data, List<? extends Group< ? extends BasicViewDescription< ? extends BasicViewSetup > > > viewDescriptions, RegularTranslationParameters params, boolean applyToAllTimePoints) { if (!applyToAllTimePoints) applyToSpimDataSingleTP( data, viewDescriptions, params, viewDescriptions.get( 0 ).iterator().next().getTimePoint() ); else { for (TimePoint tp : data.getSequenceDescription().getTimePoints().getTimePointsOrdered()) applyToSpimDataSingleTP( data, viewDescriptions, params, tp ); } }
for ( final TimePoint tp : seq.getTimePoints().getTimePointsOrdered() ) timepointIdentityMap.put( tp.getId(), tp.getId() );
public FusionResult( final String filepath, final String filepattern, final TimePoints timepoints, final int numSlices, final double sliceValueMin, final double sliceValueMax, final Map< Integer, AffineTransform3D > perTimePointFusionTransforms ) { final HashMap< Integer, Integer > setupIdToChannelId = new HashMap<>(); setupIdToChannelId.put( 0, 0 ); final ImgLoader fusionLoader = new FusionImageLoader<>( filepath +"/" + filepattern, setupIdToChannelId, numSlices, new FusionImageLoader.Gray32ImagePlusLoader(), sliceValueMin, sliceValueMax ); final int setupId = 0; final String name = "fused"; final int timepointId = timepoints.getTimePointsOrdered().get( 0 ).getId(); final Dimensions size = fusionLoader.getSetupImgLoader( setupId ).getImageSize( timepointId ); final VoxelDimensions voxelSize = fusionLoader.getSetupImgLoader( setupId ).getVoxelSize( timepointId ); final BasicViewSetup setup = new BasicViewSetup( setupId, name, size, voxelSize ); desc = new SequenceDescriptionMinimal( timepoints, Entity.idMap( Arrays.asList( setup ) ), fusionLoader, null ); final ArrayList< ViewRegistration > registrations = new ArrayList<>(); for ( final TimePoint timepoint : timepoints.getTimePointsOrdered() ) registrations.add( new ViewRegistration( timepoint.getId(), 0, perTimePointFusionTransforms.get( timepoint.getId() ) ) ); regs = new ViewRegistrations( registrations ); }
public RemoteImageLoaderMetaData( final Hdf5ImageLoader imgLoader, final AbstractSequenceDescription< ?, ?, ? > sequenceDescription ) { perSetupMipmapInfo = new HashMap<>(); dimsAndExistence = new HashMap<>(); final List< TimePoint > timepoints = sequenceDescription.getTimePoints().getTimePointsOrdered(); maxNumTimepoints = timepoints.get( timepoints.size() - 1 ).getId() + 1; final List< ? extends BasicViewSetup > setups = sequenceDescription.getViewSetupsOrdered(); maxNumSetups = setups.get( setups.size() - 1 ).getId() + 1; maxNumLevels = 0; for ( final BasicViewSetup setup : setups ) { final int setupId = setup.getId(); final MipmapInfo info = imgLoader.getSetupImgLoader( setupId ).getMipmapInfo(); perSetupMipmapInfo.put( setupId, info ); final int numLevels = info.getNumLevels(); if ( numLevels > maxNumLevels ) maxNumLevels = numLevels; for ( final TimePoint timepoint : timepoints ) { final int timepointId = timepoint.getId(); for ( int level = 0; level < numLevels; ++level ) { final ViewLevelId id = new ViewLevelId( timepointId, setupId, level ); dimsAndExistence.put( id, imgLoader.getDimsAndExistence( id ) ); } } } }
Integer timepointId = data.getSequenceDescription().getTimePoints().getTimePointsOrdered().get( bdv.getViewer().getState().getCurrentTimepoint()).getId(); BasicViewDescription< ? > vd = data.getSequenceDescription().getViewDescriptions().get( new ViewId( timepointId, cs.getSetupId() ) ); vds.add( vd );
public void initCachedDimensionsFromHdf5( final boolean background ) { open(); final long t0 = System.currentTimeMillis(); final List< TimePoint > timepoints = sequenceDescription.getTimePoints().getTimePointsOrdered(); final List< ? extends BasicViewSetup > setups = sequenceDescription.getViewSetupsOrdered(); for ( final TimePoint timepoint : timepoints ) { final int t = timepoint.getId(); for ( final BasicViewSetup setup : setups ) { final int s = setup.getId(); final int numLevels = getSetupImgLoader( s ).numMipmapLevels(); for ( int l = 0; l < numLevels; ++l ) getDimsAndExistence( new ViewLevelId( t, s, l ) ); } if ( background ) synchronized ( this ) { try { wait( 100 ); } catch ( final InterruptedException e ) {} } } final long t1 = System.currentTimeMillis() - t0; System.out.println( "initCachedDimensionsFromHdf5 : " + t1 + " ms" ); }
final int timepointId = sequenceDescription.getTimePoints().getTimePointsOrdered().get( 0 ).getId(); for ( int level = 0; level < numLevels; ++level )
public static void applyCal( final Cal maxCal, final SpimData spimData, final List< ViewId > viewIds ) { // this is the same for all timepoints, we are just interested in the ViewSetup final TimePoint t = spimData.getSequenceDescription().getTimePoints().getTimePointsOrdered().get( 0 ); for ( final ViewId viewId : viewIds ) { if ( viewId.getTimePointId() != t.getId() ) continue; final ViewDescription desc = spimData.getSequenceDescription().getViewDescriptions().get( viewId ); final ViewSetup viewSetup = desc.getViewSetup(); viewSetup.setVoxelSize( new FinalVoxelDimensions( maxCal.unit(), maxCal.getCal()[ 0 ], maxCal.getCal()[ 1 ], maxCal.getCal()[ 2 ] ) ); } }
imgLoader.printMipmapInfo(); final int timepointId = seq.getTimePoints().getTimePointsOrdered().get( 0 ).getId(); for ( final BasicViewSetup setup : seq.getViewSetupsOrdered() )
for ( final TimePoint t : spimData.getSequenceDescription().getTimePoints().getTimePointsOrdered() )
for (TimePoint tp : timepoints.getTimePointsOrdered()) for (ViewSetup setup : setups)
this.name = name; final AbstractSequenceDescription< ?, ?, ? > seq = spimData.getSequenceDescription(); timePointsOrdered = seq.getTimePoints().getTimePointsOrdered(); viewRegistrations = spimData.getViewRegistrations().getViewRegistrations(); missingViews = seq.getMissingViews() == null
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; }