本文整理汇总了Java中mpicbg.spim.data.SpimDataException类的典型用法代码示例。如果您正苦于以下问题:Java SpimDataException类的具体用法?Java SpimDataException怎么用?Java SpimDataException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpimDataException类属于mpicbg.spim.data包,在下文中一共展示了SpimDataException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
@Override
public SpimDataMinimal[] load()
{
SpimDataMinimal spimData = null;
try
{
spimData = new XmlIoSpimDataMinimal().load( xmlPath );
if ( WrapBasicImgLoader.wrapImgLoaderIfNecessary( spimData ) )
{
System.err.println( "WARNING:\nOpening <SpimData> dataset that is not suited for interactive browsing.\nConsider resaving as HDF5 for better performance." );
}
}
catch ( final SpimDataException e )
{
e.printStackTrace();
}
return new SpimDataMinimal[]{ spimData };
}
示例2: CellHandler
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
public CellHandler( final String baseUrl, final String xmlFilename, final String datasetName, final String thumbnailsDirectory ) throws SpimDataException, IOException
{
final XmlIoSpimDataMinimal io = new XmlIoSpimDataMinimal();
final SpimDataMinimal spimData = io.load( xmlFilename );
final SequenceDescriptionMinimal seq = spimData.getSequenceDescription();
final Hdf5ImageLoader imgLoader = ( Hdf5ImageLoader ) seq.getImgLoader();
cache = imgLoader.getCacheControl();
loader = imgLoader.getShortArrayLoader();
cacheHints = new CacheHints( LoadingStrategy.BLOCKING, 0, false );
// dataSetURL property is used for providing the XML file by replace
// SequenceDescription>ImageLoader>baseUrl
this.xmlFilename = xmlFilename;
baseFilename = xmlFilename.endsWith( ".xml" ) ? xmlFilename.substring( 0, xmlFilename.length() - ".xml".length() ) : xmlFilename;
dataSetURL = baseUrl;
datasetXmlString = buildRemoteDatasetXML( io, spimData, baseUrl );
metadataJson = buildMetadataJsonString( imgLoader, seq );
settingsXmlString = buildSettingsXML( baseFilename );
thumbnailFilename = createThumbnail( spimData, baseFilename, datasetName, thumbnailsDirectory );
}
示例3: createHandlers
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
private static ContextHandlerCollection createHandlers( final String baseURL, final Map< String, String > dataSet, final String thumbnailsDirectoryName ) throws SpimDataException, IOException
{
final ContextHandlerCollection handlers = new ContextHandlerCollection();
for ( final Entry< String, String > entry : dataSet.entrySet() )
{
final String name = entry.getKey();
final String xmlpath = entry.getValue();
final String context = "/" + name;
final CellHandler ctx = new CellHandler( baseURL + context + "/", xmlpath, name, thumbnailsDirectoryName );
ctx.setContextPath( context );
handlers.addHandler( ctx );
}
return handlers;
}
示例4: exec
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
public void exec( final String xmlHDF5Path, final int setupID, final String tgmmPath, final String outputPath, final boolean doCrop, final RealInterval interval, final int tFrom, final int tTo )
{
SpimDataMinimal spimData;
try
{
spimData = new XmlIoSpimDataMinimal().load( xmlHDF5Path );
}
catch ( final SpimDataException e )
{
logger.error( "Problem reading the transforms in image data file:\n" + e.getMessage() + "\n" );
return;
}
final Model model = createModel( new File( tgmmPath ), spimData, setupID, interval, tFrom, tTo );
model.setLogger( logger );
final Settings settings = createSettings( new File( xmlHDF5Path ) );
final TrackMate trackmate = new TrackMate( model, settings );
trackmate.setNumThreads( 1 );
trackmate.computeSpotFeatures( true );
trackmate.computeEdgeFeatures( true );
trackmate.computeTrackFeatures( true );
save( outputPath, model, settings );
}
示例5: run
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
@Override
public void run( final String ignored )
{
final File imageFile = askForImageFile();
if ( null == imageFile ) { return; }
final File tgmmFolder = askForTGMMFolder();
if ( null == tgmmFolder ) { return; }
SpimDataMinimal spimData;
try
{
spimData = new XmlIoSpimDataMinimal().load( imageFile.getAbsolutePath() );
}
catch ( final SpimDataException e )
{
logger.error( "Problem reading the transforms in image data file:\n" + e.getMessage() + "\n" );
return;
}
final String[] angles = readSetupNames( spimData.getSequenceDescription() );
final int angleIndex = askForAngle( angles );
if ( angleIndex < 0 ) { return; }
final int setupID = spimData.getSequenceDescription().getViewSetupsOrdered().get( angleIndex ).getId();
launchMamut( imageFile, tgmmFolder, setupID, interval );
}
示例6: launchMamut
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
public void launchMamut( final File imageFile, final File tgmmFile, final int setupID, final RealInterval interval )
{
SpimDataMinimal spimData;
try
{
spimData = new XmlIoSpimDataMinimal().load( imageFile.getAbsolutePath() );
}
catch ( final SpimDataException e )
{
logger.error( "Problem reading the transforms in image data file:\n" + e.getMessage() + "\n" );
return;
}
final Model model = createModel( tgmmFile, spimData, setupID, interval );
final SourceSettings settings = createSettings();
new MaMuT( imageFile, model, settings );
}
示例7: fix
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
public static void fix( final String xmlFilename ) throws SpimDataException, IOException
{
final XmlIoSpimDataMinimal spimDataIo = new XmlIoSpimDataMinimal();
final SpimDataMinimal spimData = spimDataIo.load( xmlFilename );
final SequenceDescriptionMinimal seq = spimData.getSequenceDescription();
final Hdf5ImageLoader il = ( Hdf5ImageLoader) seq.getImgLoader();
final String outfn = il.getHdf5File().getCanonicalPath() + "FIXED";
final HashMap< Integer, ExportMipmapInfo > perSetupMipmapInfo = new HashMap<>();
for ( final BasicViewSetup setup : seq.getViewSetupsOrdered() )
{
final int setupId = setup.getId();
final MipmapInfo info = il.getSetupImgLoader( setupId ).getMipmapInfo();
perSetupMipmapInfo.put( setupId, new ExportMipmapInfo(
Util.castToInts( info.getResolutions() ),
info.getSubdivisions() ) );
}
final ArrayList< Partition > partitions = il.getPartitions();
WriteSequenceToHdf5.writeHdf5PartitionLinkFile( seq, perSetupMipmapInfo, partitions, new File( outfn ) );
System.out.println( "fixed hdf5 master file written to " + outfn );
System.out.println( "rename it to " + il.getHdf5File().getCanonicalPath() + " to use it." );
}
示例8: writeXML
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
public static < T extends AbstractSpimData< A >, A extends AbstractSequenceDescription< ?, ?, ? super ImgLoader > > void writeXML(
final T spimData,
final XmlIoAbstractSpimData< A, T > io,
final Parameters params,
final ProgressWriter progressWriter )
throws SpimDataException
{
final A seq = spimData.getSequenceDescription();
final ArrayList< Partition > partitions = getPartitions( spimData, params );
final Hdf5ImageLoader hdf5Loader = new Hdf5ImageLoader( params.hdf5File, partitions, null, false );
seq.setImgLoader( hdf5Loader );
spimData.setBasePath( params.seqFile.getParentFile() );
try
{
if ( !params.onlyRunSingleJob || params.jobId == 0 )
io.save( spimData, params.seqFile.getAbsolutePath() );
progressWriter.setProgress( 1.0 );
}
catch ( final Exception e )
{
progressWriter.err().println( "Failed to write xml file " + params.seqFile );
e.printStackTrace( progressWriter.err() );
}
progressWriter.out().println( "done" );
}
示例9: fromXml
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
public BoundingBoxes fromXml( final Element allBoundingBoxes ) throws SpimDataException
{
final BoundingBoxes boundingBoxes = super.fromXml( allBoundingBoxes );
for ( final Element boundingBoxElement : allBoundingBoxes.getChildren( BOUNDINGBOX_TAG ) )
{
final String title = boundingBoxElement.getAttributeValue( BOUNDINGBOX_TAG_NAME );
final int[] min = XmlHelpers.getIntArray( boundingBoxElement, BOUNDINGBOX_TAG_MIN );
final int[] max = XmlHelpers.getIntArray( boundingBoxElement, BOUNDINGBOX_TAG_MAX );
boundingBoxes.addBoundingBox( new BoundingBox( title, min, max ) );
}
return boundingBoxes;
}
示例10: fromXml
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
public ViewInterestPoints fromXml( final Element allInterestPointLists, final File basePath, final Map< ViewId, ViewDescription > viewDescriptions ) throws SpimDataException
{
final ViewInterestPoints viewsInterestPoints = super.fromXml( allInterestPointLists );
viewsInterestPoints.createViewInterestPoints( viewDescriptions );
for ( final Element viewInterestPointsElement : allInterestPointLists.getChildren( VIEWINTERESTPOINTSFILE_TAG ) )
{
final int timepointId = Integer.parseInt( viewInterestPointsElement.getAttributeValue( VIEWINTERESTPOINTS_TIMEPOINT_ATTRIBUTE_NAME ) );
final int setupId = Integer.parseInt( viewInterestPointsElement.getAttributeValue( VIEWINTERESTPOINTS_SETUP_ATTRIBUTE_NAME ) );
final String label = viewInterestPointsElement.getAttributeValue( VIEWINTERESTPOINTS_LABEL_ATTRIBUTE_NAME );
final String parameters = viewInterestPointsElement.getAttributeValue( VIEWINTERESTPOINTS_PARAMETERS_ATTRIBUTE_NAME );
final String interestPointFileName = viewInterestPointsElement.getTextTrim();
final ViewId viewId = new ViewId( timepointId, setupId );
final ViewInterestPointLists collection = viewsInterestPoints.getViewInterestPointLists( viewId );
// we do not load the interestpoints nor the correspondinginterestpoints, we just do that once it is requested
final InterestPointList list = new InterestPointList( basePath, new File( interestPointFileName ) );
list.setParameters( parameters );
collection.addInterestPointList( label, list );
}
return viewsInterestPoints;
}
示例11: finish
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
@Override
public boolean finish()
{
System.out.println( "finish()" );
String path = params.getSeqFile().getAbsolutePath();
try
{
new XmlIoSpimData2( "" ).save( spimData, path );
IOFunctions.println( "(" + new Date( System.currentTimeMillis() ) + "): Saved xml '" + path + "'." );
// 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 '" + path + "'." );
e.printStackTrace();
return false;
}
}
示例12: finish
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
@Override
public boolean finish()
{
XmlIoSpimData2 io = new XmlIoSpimData2( "" );
try
{
io.save( spimData, 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;
}
}
示例13: load
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
public T load( final String xmlFilename ) throws SpimDataException
{
final SAXBuilder sax = new SAXBuilder();
Document doc;
try
{
final File file = new File( xmlFilename );
if ( file.exists() )
doc = sax.build( file );
else
doc = sax.build( xmlFilename );
}
catch ( final Exception e )
{
throw new SpimDataIOException( e );
}
final Element root = doc.getRootElement();
if ( root.getName() != SPIMDATA_TAG )
throw new RuntimeException( "expected <" + SPIMDATA_TAG + "> root element. wrong file?" );
return fromXml( root, new File( xmlFilename ) );
}
示例14: fromXml
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
/**
* TODO
*
* @param root
* @param xmlFile
* @return
*/
public T fromXml( final Element root, final File xmlFile ) throws SpimDataException
{
final T spimData = super.fromXml( root );
// String version = getVersion( root );
final File basePath = loadBasePath( root, xmlFile );
spimData.setBasePath( basePath );
Element elem = root.getChild( xmlIoSequenceDescription.getTag() );
if ( elem == null )
throw new SpimDataIOException( "no <" + xmlIoSequenceDescription.getTag() + "> element found." );
spimData.setSequenceDescription( xmlIoSequenceDescription.fromXml( elem, basePath ) );
elem = root.getChild( xmlIoViewRegistrations.getTag() );
if ( elem == null )
throw new SpimDataIOException( "no <" + xmlIoViewRegistrations.getTag() + "> element found." );
spimData.setViewRegistrations( xmlIoViewRegistrations.fromXml( elem ) );
return spimData;
}
示例15: fromXml
import mpicbg.spim.data.SpimDataException; //导入依赖的package包/类
/**
* Create an object from the given element. Unhandled children of the
* element are stored as associated with the objects {@link Entity#getId()
* id} and added to any XML element {@link #toXml(Entity) created} for that
* id.
*/
public T fromXml( final Element elem ) throws SpimDataException
{
T entity;
try
{
entity = ctor.newInstance();
}
catch ( final Exception e )
{
throw new SpimDataInstantiationException( "Cannot instantiate Entity " + getEntityClass().getName(), e );
}
entity.setId( XmlHelpers.getInt( elem, ID_TAG ) );
final ArrayList< Element > unhandled = new ArrayList< Element >();
for ( final Element c : elem.getChildren() )
if ( !handledTags.contains( c.getName() ) )
unhandled.add( c.clone() );
if ( !unhandled.isEmpty() )
unhandledContent.put( entity.getId(), unhandled );
return entity;
}