本文整理汇总了Java中ch.systemsx.cisd.hdf5.HDF5Factory.openForReading方法的典型用法代码示例。如果您正苦于以下问题:Java HDF5Factory.openForReading方法的具体用法?Java HDF5Factory.openForReading怎么用?Java HDF5Factory.openForReading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.systemsx.cisd.hdf5.HDF5Factory
的用法示例。
在下文中一共展示了HDF5Factory.openForReading方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AnnotationsHdf5Store
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Create a new HDF5 store for the given file. Annotations will be read from and written to the given group.
* @param filename
* @param groupname
*/
public AnnotationsHdf5Store(final String filename, final String groupname, final IdService idService) {
this.filename = filename;
this.groupname = groupname;
this.idService = idService;
final IHDF5Reader reader = HDF5Factory.openForReading(filename);
// TODO: following call is deprecated, but what to use instead?
if (reader.object().hasAttribute("/", "file_format")) {
fileFormat = Double.parseDouble(reader.string().getAttr("/", "file_format"));
} else {
fileFormat = 0.0;
}
if (reader.exists(groupname) && reader.hasAttribute(groupname, "offset")) {
final float[] data = reader.getFloatArrayAttribute(groupname, "offset");
offset[0] = data[2];
offset[1] = data[1];
offset[2] = data[0];
}
reader.close();
System.out.println("AnnotationsHdf5Store: detected file format " + fileFormat);
}
示例2: initRaw
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load raw data, find maximum raw dimensions
*
* @param params
* @throws IOException
*/
@Override
protected void initRaw( final P params ) throws IOException
{
System.out.println( "Opening raw from " + params.inFile );
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFile );
/* raw pixels */
Arrays.fill( maxRawDimensions, 0 );
for ( final String raw : params.raws )
if ( reader.exists( raw ) )
{
final H5UnsignedByteSetupImageLoader rawLoader = new H5UnsignedByteSetupImageLoader( reader, raw, setupId++, cellDimensions, cache );
raws.add( rawLoader );
max( maxRawDimensions, Intervals.dimensionsAsLongArray( rawLoader.getVolatileImage( 0, 0 ) ) );
}
else
System.out.println( "no raw dataset '" + raw + "' found" );
}
示例3: initCanvas
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load or initialize canvas
*
* @param params
* @throws IOException
*/
protected void initCanvas( final P params ) throws IOException
{
System.out.println( "Opening canvas from " + params.inFile );
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFile );
/* canvas (to which the brush paints) */
if ( reader.exists( params.canvas ) )
canvas = H5Utils.loadUnsignedLong( reader, params.canvas, cellDimensions );
else
{
canvas = new CellImgFactory< LongType >( cellDimensions ).create( maxRawDimensions, new LongType() );
for ( final LongType t : canvas )
t.set( Label.TRANSPARENT );
}
reader.close();
}
示例4: initRaw
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load raw data and labels and initialize canvas
*
* @param params
* @throws IOException
*/
protected void initRaw( final P params ) throws IOException
{
System.out.println( "Opening raw from " + params.inFile );
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFile );
/* raw pixels */
for ( final String raw : params.raws )
{
if ( reader.exists( raw ) )
{
final H5UnsignedByteSetupImageLoader rawLoader = new H5UnsignedByteSetupImageLoader( reader, raw, setupId++, cellDimensions, cache );
raws.add( rawLoader );
}
else
System.out.println( "no raw dataset '" + raw + "' found" );
}
}
示例5: initIdService
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Initialize ID service.
*
* @param params
* @throws IOException
*/
protected void initIdService( final P params ) throws IOException
{
/* id */
idService = new LocalIdService();
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFile );
long maxId = 0;
final Long nextIdObject = H5Utils.loadAttribute( reader, "/", "next_id" );
reader.close();
if ( nextIdObject == null )
{
for ( final H5LabelMultisetSetupImageLoader labelLoader : labels )
maxId = maxId( labelLoader, maxId );
}
else
maxId = nextIdObject.longValue() - 1;
idService.invalidate( maxId );
}
示例6: initAssignments
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Initialize assignments.
*
* @param params
*/
protected void initAssignments( final P params )
{
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFile );
/* fragment segment assignment */
assignment = new FragmentSegmentAssignment( idService );
final TLongLongHashMap lut = H5Utils.loadLongLongLut( reader, params.assignment, 1024 );
if ( lut != null )
assignment.initLut( lut );
/* complete fragments */
completeFragmentsAssignment = new FragmentAssignment();
final TLongHashSet set = new TLongHashSet();
H5Utils.loadLongCollection( set, reader, params.completeFragments, 1024 );
/* color stream */
colorStream = new ModalGoldenAngleSaturatedARGBStream( assignment );
colorStream.setAlpha( 0x20 );
reader.close();
}
示例7: importHdf5
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
public static SortedMap<Number, Number> importHdf5(String filePath) {
reader = HDF5Factory.openForReading(filePath);
double[][] hdf5Data = reader.readDoubleMatrix(DATA_ID);
SortedMap<Number, Number> data = new TreeMap<>();
for (int i = 0; i < hdf5Data[0].length; i++) {
double x = hdf5Data[0][i];
double y = hdf5Data[1][i];
Number key = new Double(x);
Number value = new Double(y);
data.put(key, value);
}
return data;
}
示例8: parse
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
@Override
public ArrayList<Sample> parse(String filepath) throws IOException{
ArrayList<Sample> sampleList = new ArrayList<>();
IHDF5SimpleReader reader = HDF5Factory.openForReading(filepath);
// Get number of Samples in File
String[] sampleIds = reader.readStringArray("/sample/ids");
String[] observationIds = reader.readStringArray("/observation/ids");
int[] indptr = reader.readIntArray("/sample/matrix/indptr");
int[] indices = reader.readIntArray("/sample/matrix/indices");
float[] data = reader.readFloatArray("/sample/matrix/data");
// Loop over Samples
for (int i = 0; i < sampleIds.length ; i++) {
// Create new Sample
Sample newSample = new Sample();
newSample.setSampleId(sampleIds[i]);
// Add counts to this sample
for (int j = indptr[i]; j < indptr[i+1]; j++) {
TaxonNode node = taxonTree.getNodeForID(Integer.parseInt(observationIds[indices[j]]));
newSample.getTaxa2CountMap().put(node, Math.round(data[j]));
}
// Loop over Metadata-Entries
for (String metaKey: reader.getGroupMembers("/sample/metadata")) {
System.out.println(metaKey);
String metaValue = reader.readStringArray("/sample/metadata/" + metaKey)[i];
newSample.getMetaData().put(metaKey, metaValue);
}
sampleList.add(newSample);
}
return sampleList;
}
示例9: initIdService
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Initialize ID service, load max id from file or find max id in labels and
* canvas.
*
* @param params
* @throws IOException
*/
@Override
protected void initIdService( final P params ) throws IOException
{
/* id */
idService = new LocalIdService();
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFile );
long maxId = 0;
final Long nextIdObject = H5Utils.loadAttribute( reader, "/", "next_id" );
if ( nextIdObject == null )
{
for ( final H5LabelMultisetSetupImageLoader labelLoader : labels )
maxId = maxId( labelLoader, maxId );
if ( reader.exists( params.canvas ) )
maxId = maxId( canvas, maxId );
}
else
maxId = nextIdObject.longValue() - 1;
idService.invalidate( maxId );
reader.close();
}
示例10: initLabels
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load labels and create label+canvas compositions.
*
* @param params
* @throws IOException
*/
protected void initLabels( final P params ) throws IOException
{
System.out.println( "Opening labels from " + params.inFileLabels );
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFileLabels );
/* labels */
for ( final String label : params.labels )
if ( reader.exists( label ) )
readLabels( reader, label );
else
System.out.println( "no label dataset '" + label + "' found" );
}
示例11: loadFloat
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load an HDF5 float32 dataset into a {@link CellImg} of {@link FloatType}.
*
* @param file
* @param dataset
* @param cellDimensions
*/
static public CellImg< FloatType, ? > loadFloat(
final File file,
final String dataset,
final int[] cellDimensions )
{
final IHDF5Reader reader = HDF5Factory.openForReading( file );
final CellImg< FloatType, ? > target = loadFloat( reader, dataset, cellDimensions );
reader.close();
return target;
}
示例12: loadDouble
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load an HDF5 float64 dataset into a {@link CellImg} of {@link DoubleType}.
*
* @param file
* @param dataset
* @param cellDimensions
*/
static public CellImg< DoubleType, ? > loadDouble(
final File file,
final String dataset,
final int[] cellDimensions )
{
final IHDF5Reader reader = HDF5Factory.openForReading( file );
final CellImg< DoubleType, ? > target = loadDouble( reader, dataset, cellDimensions );
reader.close();
return target;
}
示例13: loadUnsignedLong
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load an HDF5 uint64 dataset into a {@link CellImg} of {@link LongType}.
*
* @param file
* @param dataset
* @param cellDimensions
*/
static public CellImg< LongType, ? > loadUnsignedLong(
final File file,
final String dataset,
final int[] cellDimensions )
{
final IHDF5Reader reader = HDF5Factory.openForReading( file );
final CellImg< LongType, ? > target = loadUnsignedLong( reader, dataset, cellDimensions );
reader.close();
return target;
}
示例14: loadUnsignedShort
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load an HDF5 uint16 dataset into a {@link CellImg} of {@link UnsignedShortType}.
*
* @param file
* @param dataset
* @param cellDimensions
*/
static public CellImg< UnsignedShortType, ? > loadUnsignedShort(
final File file,
final String dataset,
final int[] cellDimensions )
{
final IHDF5Reader reader = HDF5Factory.openForReading( file );
final CellImg< UnsignedShortType, ? > target = loadUnsignedShort( reader, dataset, cellDimensions );
reader.close();
return target;
}
示例15: loadUnsignedByte
import ch.systemsx.cisd.hdf5.HDF5Factory; //导入方法依赖的package包/类
/**
* Load an HDF5 uint8 dataset into a {@link CellImg} of {@link UnsignedByteType}.
*
* @param file
* @param dataset
* @param cellDimensions
*/
static public CellImg< UnsignedByteType, ? > loadUnsignedByte(
final File file,
final String dataset,
final int[] cellDimensions )
{
final IHDF5Reader reader = HDF5Factory.openForReading( file );
final CellImg< UnsignedByteType, ? > target = loadUnsignedByte( reader, dataset, cellDimensions );
reader.close();
return target;
}