本文整理匯總了Java中mpicbg.spim.io.IOFunctions.printlnSafe方法的典型用法代碼示例。如果您正苦於以下問題:Java IOFunctions.printlnSafe方法的具體用法?Java IOFunctions.printlnSafe怎麽用?Java IOFunctions.printlnSafe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mpicbg.spim.io.IOFunctions
的用法示例。
在下文中一共展示了IOFunctions.printlnSafe方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getImage
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
@Override
public RandomAccessibleInterval< UnsignedShortType > getImage( final ViewId view )
{
try
{
final MultipageTiffReader r = new MultipageTiffReader( mmFile );
final ArrayImg< UnsignedShortType, ? > img = ArrayImgs.unsignedShorts( r.width(), r.height(), r.depth() );
final BasicViewDescription< ? > vd = sequenceDescription.getViewDescriptions().get( view );
populateImage( img, vd, r );
updateMetaDataCache( view, r.width(), r.height(), r.depth(), r.calX(), r.calY(), r.calZ() );
r.close();
return img;
}
catch ( Exception e )
{
IOFunctions.printlnSafe( "Failed to load viewsetup=" + view.getViewSetupId() + " timepoint=" + view.getTimePointId() + ": " + e );
e.printStackTrace();
return null;
}
}
示例2: loadMetaData
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
@Override
protected void loadMetaData( final ViewId view )
{
try
{
final MultipageTiffReader r = new MultipageTiffReader( mmFile );
updateMetaDataCache( view, r.width(), r.height(), r.depth(), r.calX(), r.calY(), r.calZ() );
r.close();
}
catch ( Exception e )
{
IOFunctions.printlnSafe( "Failed to load metadata for viewsetup=" + view.getViewSetupId() + " timepoint=" + view.getTimePointId() + ": " + e );
e.printStackTrace();
}
}
示例3: getFile
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
protected File getFile( final ViewId view )
{
final TimePoint tp = sequenceDescription.getTimePoints().getTimePoints().get( view.getTimePointId() );
final BasicViewSetup vs = sequenceDescription.getViewSetups().get( view.getViewSetupId() );
final String timepoint = tp.getName();
final String angle = vs.getAttribute( Angle.class ).getName();
final String channel = vs.getAttribute( Channel.class ).getName();
final String illum = vs.getAttribute( Illumination.class ).getName();
final String[] fileName = StackList.getFileNamesFor( fileNamePattern, replaceTimepoints, replaceChannels,
replaceIlluminations, replaceAngles, timepoint, channel, illum, angle,
numDigitsTimepoints, numDigitsChannels, numDigitsIlluminations, numDigitsAngles );
// check which of them exists and return it
for ( final String fn : fileName )
{
final File f = new File( path, fn );
if ( f.exists() )
return f;
else
IOFunctions.printlnSafe( "File '" + f.getAbsolutePath() + "' does not exist." );
}
IOFunctions.printlnSafe( "Could not find file for tp=" + timepoint + ", angle=" + angle + ", channel=" + channel + ", ill=" + illum );
return null;
}
示例4: getFloatImage
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
@Override
public RandomAccessibleInterval< FloatType > getFloatImage( final ViewId view, final boolean normalize )
{
try
{
final MultipageTiffReader r = new MultipageTiffReader( mmFile );
final ArrayImg< FloatType, ? > img = ArrayImgs.floats( r.width(), r.height(), r.depth() );
final BasicViewDescription< ? > vd = sequenceDescription.getViewDescriptions().get( view );
populateImage( img, vd, r );
if ( normalize )
normalize( img );
updateMetaDataCache( view, r.width(), r.height(), r.depth(), r.calX(), r.calY(), r.calZ() );
r.close();
return img;
}
catch ( Exception e )
{
IOFunctions.printlnSafe( "Failed to load viewsetup=" + view.getViewSetupId() + " timepoint=" + view.getTimePointId() + ": " + e );
e.printStackTrace();
return null;
}
}
示例5: finalize
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
@Override
public void finalize()
{
IOFunctions.printlnSafe( "Closing czi: " + cziFile );
try
{
if ( meta != null && meta.getReader() != null )
{
meta.getReader().close();
isClosed = true;
}
}
catch (IOException e) {}
}
示例6: getRGBAndByteDepth
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
private void getRGBAndByteDepth( final HashMap< String, Object > map )
{
try {
String pixelType = getPixelType();
rgb_ = pixelType.startsWith("RGB");
if (pixelType.equals("RGB32") || pixelType.equals("GRAY8")) {
byteDepth_ = 1;
} else {
byteDepth_ = 2;
}
} catch (Exception ex) {
IOFunctions.printlnSafe(ex);
}
}
示例7: readImage
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
public Pair< Object, HashMap< String, Object > > readImage( final String label )
{
if ( indexMap_.containsKey( label ) )
{
final FileChannel fileChannel = indexMap_.get( label ).getB();
if ( fileChannel == null )
{
IOFunctions.printlnSafe( "Attempted to read image on FileChannel that is null" );
return null;
}
try
{
final long byteOffset = indexMap_.get( label ).getA();
final IFDData data = readIFD( byteOffset, fileChannel );
return readTaggedImage( data, fileChannel );
}
catch ( IOException ex )
{
IOFunctions.printlnSafe(ex);
return null;
}
}
else
{
IOFunctions.printlnSafe( "Exception: label '" + label + "' not in present in hashmap, cannot read data." );
// label not in map--either writer hasnt finished writing it
return null;
}
}
示例8: readIndexMap
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
private void readIndexMap( final FileChannel fileChannel, final HashMap< String, Pair< Long, FileChannel > > indexMap_ ) throws IOException
{
final long offset = readOffsetHeaderAndOffset( INDEX_MAP_OFFSET_HEADER, 8, fileChannel );
final ByteBuffer header = readIntoBuffer( offset, 8, fileChannel );
if ( header.getInt(0) != INDEX_MAP_HEADER )
throw new RuntimeException( "Error reading index map header" );
final int numMappings = header.getInt( 4 );
final ByteBuffer mapBuffer = readIntoBuffer( offset + 8, 20 * numMappings, fileChannel );
for ( int i = 0; i < numMappings; ++i )
{
final int channel = mapBuffer.getInt( i * 20 );
final int slice = mapBuffer.getInt( i * 20 + 4 );
final int frame = mapBuffer.getInt( i * 20 + 8 );
final int position = mapBuffer.getInt( i * 20 + 12 );
final long imageOffset = unsignInt( mapBuffer.getInt( i * 20 + 16 ) );
if ( imageOffset == 0 )
break; // end of index map reached
// If a duplicate label is read, forget about the previous one
// if data has been intentionally overwritten, this gives the most
// current version
final String label = generateLabel( channel, slice, frame, position );
if ( indexMap_.containsKey( label ) )
IOFunctions.printlnSafe( "ERROR!!! Label: " + label + " already present." );
//System.out.println( label + " " + getFileForFileChannel( fileChannel ).getName() );
indexMap_.put( label, new ValuePair< Long, FileChannel >( imageOffset, fileChannel ) );
}
}
示例9: getString
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
private String getString(ByteBuffer buffer) {
try {
return new String(buffer.array(), "UTF-8");
} catch (UnsupportedEncodingException ex) {
IOFunctions.printlnSafe(ex);
return "";
}
}
示例10: readTaggedImage
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
private Pair< Object, HashMap< String, Object > > readTaggedImage( final IFDData data, final FileChannel fileChannel ) throws IOException
{
final ByteBuffer pixelBuffer = ByteBuffer.allocate( (int)data.bytesPerImage).order( byteOrder_ );
final ByteBuffer mdBuffer = ByteBuffer.allocate( (int)data.mdLength).order( byteOrder_ );
fileChannel.read( pixelBuffer, data.pixelOffset );
fileChannel.read( mdBuffer, data.mdOffset );
final HashMap< String, Object > md = parseJSONSimple( getString( mdBuffer ) );
if ( byteDepth_ == 0 )
getRGBAndByteDepth( md );
if ( rgb_ )
{
IOFunctions.printlnSafe( "RGB types not supported." );
return null;
}
else
{
if (byteDepth_ == 1)
{
return new ValuePair<Object, HashMap< String, Object >>( pixelBuffer.array(), md );
}
else
{
final short[] pix = new short[ pixelBuffer.capacity() / 2 ];
for ( int i = 0; i < pix.length; ++i )
pix[ i ] = pixelBuffer.getShort( i * 2 );
return new ValuePair<Object, HashMap< String, Object >>( pix, md );
}
}
}
示例11: rotationAngle
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
public String rotationAngle( final int angleId )
{
if ( angleId < 0 || angleId >= numAngles() )
{
IOFunctions.printlnSafe( "No angle with id " + angleId + ", there are only " + numAngles() + " angles." );
return String.valueOf( angleId );
}
if ( this.angleNames != null )
return this.angleNames.get( angleId );
// MVRotations = 0_90_0_90
// >>> channels increasing, angles increasing faster
try
{
final String ac = summaryMetadata_.get( "MVRotations" ).toString().trim();
final String[] entries = ac.split( "_" );
return entries[ angleId ];
}
catch ( Exception e )
{
IOFunctions.printlnSafe( "Failed to get rotation angle: " + e );
return "0";
}
}
示例12: open
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
public static ImagePlus open( File file )
{
final ImagePlus imp = new Opener().openImage( file.getAbsolutePath() );
if ( imp == null )
{
IOFunctions.printlnSafe( "Could not open file with ImageJ TIFF reader: '" + file.getAbsolutePath() + "'" );
return null;
}
return imp;
}
示例13: getFloatImage
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
/**
* Get {@link FloatType} image normalized to the range [0,1].
*
* @param view
* timepoint and setup for which to retrieve the image.
* @param normalize
* if the image should be normalized to [0,1] or not
* @return {@link FloatType} image normalized to range [0,1]
*/
@Override
public RandomAccessibleInterval< FloatType > getFloatImage( final ViewId view, final boolean normalize )
{
final File file = getFile( view );
if ( file == null )
throw new RuntimeException( "Could not find file '" + file + "'." );
IOFunctions.printlnSafe( new Date( System.currentTimeMillis() ) + ": Loading '" + file + "' ..." );
final ImagePlus imp = open( file );
if ( imp == null )
throw new RuntimeException( "Could not load '" + file + "'." );
final long[] dim = new long[]{ imp.getWidth(), imp.getHeight(), imp.getStack().getSize() };
final Img< FloatType > img = this.instantiateImg( dim, new FloatType() );
if ( img == null )
throw new RuntimeException( "Could not instantiate " + getImgFactory().getClass().getSimpleName() + " for '" + file + "', most likely out of memory." );
else
IOFunctions.printlnSafe( new Date( System.currentTimeMillis() ) + ": Opened '" + file + "' [" + dim[ 0 ] + "x" + dim[ 1 ] + "x" + dim[ 2 ] + " image=" + img.getClass().getSimpleName() + "<FloatType>]" );
imagePlus2ImgLib2Img( imp, img, normalize );
// update the MetaDataCache of the AbstractImgLoader
// this does not update the XML ViewSetup but has to be called explicitly before saving
updateMetaDataCache( view, imp.getWidth(), imp.getHeight(), imp.getStack().getSize(),
imp.getCalibration().pixelWidth, imp.getCalibration().pixelHeight, imp.getCalibration().pixelDepth );
imp.close();
return img;
}
示例14: finalize
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
@Override
public void finalize()
{
IOFunctions.printlnSafe( "Closing sld: " + sldFile );
try
{
if ( meta != null && meta.getReader() != null )
{
meta.getReader().close();
isClosed = true;
}
}
catch (IOException e) {}
}
示例15: loadMetaData
import mpicbg.spim.io.IOFunctions; //導入方法依賴的package包/類
@Override
protected void loadMetaData( final ViewId view )
{
IOFunctions.printlnSafe( new Date( System.currentTimeMillis() ) + ": Loading metadata for Lightsheet Z1 imgloader not necessary." );
}