Search in sources :

Example 36 with CoreMetadata

use of loci.formats.CoreMetadata in project bioformats by openmicroscopy.

the class FujiReader method initFile.

// -- Internal FormatReader API methods --
/* @see loci.formats.FormatReader#initFile(String) */
@Override
protected void initFile(String id) throws FormatException, IOException {
    super.initFile(id);
    if (checkSuffix(id, "inf")) {
        infFile = new Location(id).getAbsolutePath();
        pixelsFile = infFile.substring(0, infFile.lastIndexOf(".")) + ".img";
    } else {
        pixelsFile = new Location(id).getAbsolutePath();
        infFile = pixelsFile.substring(0, pixelsFile.lastIndexOf(".")) + ".inf";
    }
    String[] lines = DataTools.readFile(infFile).split("\r{0,1}\n");
    int bits = Integer.parseInt(lines[5]);
    CoreMetadata m = core.get(0);
    m.pixelType = FormatTools.pixelTypeFromBytes(bits / 8, false, false);
    m.sizeX = Integer.parseInt(lines[6]);
    m.sizeY = Integer.parseInt(lines[7]);
    m.sizeC = 1;
    m.sizeT = 1;
    m.sizeZ = 1;
    m.imageCount = getSizeZ() * getSizeC() * getSizeT();
    m.dimensionOrder = "XYCZT";
    for (String line : lines) {
        addGlobalMetaList("Line", line);
    }
    MetadataStore store = makeFilterMetadata();
    MetadataTools.populatePixels(store, this);
    String imageName = lines[1];
    String timestamp = lines[10];
    timestamp = DateTools.formatDate(timestamp, DATE_FORMAT);
    store.setImageName(imageName, 0);
    if (timestamp != null) {
        store.setImageAcquisitionDate(new Timestamp(timestamp), 0);
    }
    double physicalWidth = Double.parseDouble(lines[3]);
    double physicalHeight = Double.parseDouble(lines[4]);
    Length sizeX = FormatTools.getPhysicalSizeX(physicalWidth);
    Length sizeY = FormatTools.getPhysicalSizeY(physicalHeight);
    if (sizeX != null) {
        store.setPixelsPhysicalSizeX(sizeX, 0);
    }
    if (sizeY != null) {
        store.setPixelsPhysicalSizeY(sizeY, 0);
    }
    if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
        String instrument = lines[13];
        String instrumentID = MetadataTools.createLSID("Instrument", 0);
        store.setInstrumentID(instrumentID, 0);
        store.setMicroscopeModel(instrument, 0);
    }
}
Also used : MetadataStore(loci.formats.meta.MetadataStore) Length(ome.units.quantity.Length) CoreMetadata(loci.formats.CoreMetadata) Timestamp(ome.xml.model.primitives.Timestamp) Location(loci.common.Location)

Example 37 with CoreMetadata

use of loci.formats.CoreMetadata in project bioformats by openmicroscopy.

the class GatanReader method initFile.

// -- Internal FormatReader API methods --
/* @see loci.formats.FormatReader#initFile(String) */
@Override
protected void initFile(String id) throws FormatException, IOException {
    super.initFile(id);
    in = new RandomAccessInputStream(id);
    pixelOffset = 0;
    CoreMetadata m = core.get(0);
    LOGGER.info("Verifying Gatan format");
    m.littleEndian = false;
    pixelSizes = new ArrayList<Double>();
    units = new ArrayList<String>();
    shapes = new ArrayList<ROIShape>();
    in.order(isLittleEndian());
    // only support version 3
    version = in.readInt();
    if (version != 3 && version != 4) {
        throw new FormatException("invalid header");
    }
    LOGGER.info("Reading tags");
    in.skipBytes(4);
    skipPadding();
    m.littleEndian = in.readInt() != 1;
    in.order(isLittleEndian());
    // TagGroup instance
    in.skipBytes(2);
    skipPadding();
    int numTags = in.readInt();
    if (numTags > in.length()) {
        m.littleEndian = !isLittleEndian();
        in.order(isLittleEndian());
        adjustEndianness = false;
    }
    LOGGER.debug("tags ({}) {", numTags);
    try {
        parseTags(numTags, null, "  ");
    } catch (Exception e) {
        throw new FormatException("Unable to parse metadata tag", e);
    }
    LOGGER.debug("}");
    LOGGER.info("Populating metadata");
    m.littleEndian = true;
    if (getSizeX() == 0 || getSizeY() == 0) {
        throw new FormatException("Dimensions information not found");
    }
    if (m.sizeZ == 0) {
        m.sizeZ = 1;
    }
    m.sizeC = 1;
    m.sizeT = 1;
    m.dimensionOrder = "XYZTC";
    m.imageCount = getSizeZ() * getSizeC() * getSizeT();
    int bytes = (int) (numPixelBytes / (getSizeX() * getSizeY() * (long) getImageCount()));
    if (bytes != FormatTools.getBytesPerPixel(getPixelType())) {
        m.pixelType = FormatTools.pixelTypeFromBytes(bytes, signed, false);
    }
    m.rgb = false;
    m.interleaved = false;
    m.metadataComplete = true;
    m.indexed = false;
    m.falseColor = false;
    // The metadata store we're working with.
    MetadataStore store = makeFilterMetadata();
    MetadataTools.populatePixels(store, this, true);
    if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
        int index = 0;
        if (pixelSizes.size() > 4) {
            index = pixelSizes.size() - 3;
        } else if (pixelSizes.size() == 4) {
            if (Math.abs(pixelSizes.get(0) - 1.0) < Constants.EPSILON) {
                index = pixelSizes.size() - 2;
            }
        }
        if (index + 2 < pixelSizes.size() && Math.abs(pixelSizes.get(index + 1) - pixelSizes.get(index + 2)) < Constants.EPSILON) {
            if (Math.abs(pixelSizes.get(index) - pixelSizes.get(index + 1)) > Constants.EPSILON && getSizeY() > 1) {
                index++;
            }
        }
        if (index < pixelSizes.size() - 1) {
            Double x = pixelSizes.get(index);
            Double y = pixelSizes.get(index + 1);
            String xUnits = index < units.size() ? units.get(index) : "";
            String yUnits = index + 1 < units.size() ? units.get(index + 1) : "";
            Length sizeX = FormatTools.getPhysicalSizeX(x, convertUnits(xUnits));
            Length sizeY = FormatTools.getPhysicalSizeY(y, convertUnits(yUnits));
            if (sizeX != null) {
                store.setPixelsPhysicalSizeX(sizeX, 0);
            }
            if (sizeY != null) {
                store.setPixelsPhysicalSizeY(sizeY, 0);
            }
            if (index < pixelSizes.size() - 2) {
                Double z = pixelSizes.get(index + 2);
                String zUnits = index + 2 < units.size() ? units.get(index + 2) : "";
                Length sizeZ = FormatTools.getPhysicalSizeZ(z, convertUnits(zUnits));
                if (sizeZ != null) {
                    store.setPixelsPhysicalSizeZ(sizeZ, 0);
                }
            }
        }
        String instrument = MetadataTools.createLSID("Instrument", 0);
        store.setInstrumentID(instrument, 0);
        store.setImageInstrumentRef(instrument, 0);
        String objective = MetadataTools.createLSID("Objective", 0, 0);
        store.setObjectiveID(objective, 0, 0);
        store.setObjectiveCorrection(getCorrection("Unknown"), 0, 0);
        store.setObjectiveImmersion(getImmersion("Unknown"), 0, 0);
        store.setObjectiveNominalMagnification(mag, 0, 0);
        store.setObjectiveSettingsID(objective, 0);
        String detector = MetadataTools.createLSID("Detector", 0, 0);
        store.setDetectorID(detector, 0, 0);
        store.setDetectorSettingsID(detector, 0, 0);
        store.setDetectorSettingsVoltage(new ElectricPotential(voltage, UNITS.VOLT), 0, 0);
        if (info == null)
            info = "";
        String[] scopeInfo = info.split("\\(");
        for (String token : scopeInfo) {
            token = token.trim();
            if (token.startsWith("Mode")) {
                token = token.substring(token.indexOf(' ')).trim();
                String mode = token.substring(0, token.indexOf(' ')).trim();
                if (mode.equals("TEM"))
                    mode = "Other";
                store.setChannelAcquisitionMode(getAcquisitionMode(mode), 0, 0);
            }
        }
        store.setPlanePositionX(posX, 0, 0);
        store.setPlanePositionY(posY, 0, 0);
        store.setPlanePositionZ(posZ, 0, 0);
        for (int i = 0; i < getImageCount(); i++) {
            store.setPlaneExposureTime(new Time(sampleTime, UNITS.SECOND), 0, i);
        }
    }
    if (getMetadataOptions().getMetadataLevel() != MetadataLevel.NO_OVERLAYS && shapes.size() > 0) {
        for (int i = 0; i < shapes.size(); i++) {
            String roi = MetadataTools.createLSID("ROI", i);
            store.setROIID(roi, i);
            store.setImageROIRef(roi, 0, i);
            String shapeID = MetadataTools.createLSID("Shape", i, 0);
            ROIShape shape = shapes.get(i);
            switch(shape.type) {
                case LINE:
                    store.setLineID(shapeID, i, 0);
                    store.setLineX1(shape.x1, i, 0);
                    store.setLineY1(shape.y1, i, 0);
                    store.setLineX2(shape.x2, i, 0);
                    store.setLineY2(shape.y2, i, 0);
                    store.setLineText(shape.text, i, 0);
                    store.setLineFontSize(shape.fontSize, i, 0);
                    store.setLineStrokeColor(shape.strokeColor, i, 0);
                    break;
                case TEXT:
                    store.setLabelID(shapeID, i, 0);
                    store.setLabelX(shape.x1, i, 0);
                    store.setLabelY(shape.y1, i, 0);
                    store.setLabelText(shape.text, i, 0);
                    store.setLabelFontSize(shape.fontSize, i, 0);
                    store.setLabelStrokeColor(shape.strokeColor, i, 0);
                    break;
                case ELLIPSE:
                    store.setEllipseID(shapeID, i, 0);
                    double radiusX = (shape.x2 - shape.x1) / 2;
                    double radiusY = (shape.y2 - shape.y1) / 2;
                    store.setEllipseX(shape.x1 + radiusX, i, 0);
                    store.setEllipseY(shape.y1 + radiusY, i, 0);
                    store.setEllipseRadiusX(radiusX, i, 0);
                    store.setEllipseRadiusY(radiusY, i, 0);
                    store.setEllipseText(shape.text, i, 0);
                    store.setEllipseFontSize(shape.fontSize, i, 0);
                    store.setEllipseStrokeColor(shape.strokeColor, i, 0);
                    break;
                case RECTANGLE:
                    store.setRectangleID(shapeID, i, 0);
                    store.setRectangleX(shape.x1, i, 0);
                    store.setRectangleY(shape.y1, i, 0);
                    store.setRectangleWidth(shape.x2 - shape.x1, i, 0);
                    store.setRectangleHeight(shape.y2 - shape.y1, i, 0);
                    store.setRectangleText(shape.text, i, 0);
                    store.setRectangleFontSize(shape.fontSize, i, 0);
                    store.setRectangleStrokeColor(shape.strokeColor, i, 0);
                    break;
                default:
                    LOGGER.warn("Unknown ROI type: {}", shape.type);
            }
        }
    }
}
Also used : Time(ome.units.quantity.Time) CoreMetadata(loci.formats.CoreMetadata) ElectricPotential(ome.units.quantity.ElectricPotential) FormatException(loci.formats.FormatException) FormatException(loci.formats.FormatException) IOException(java.io.IOException) ParseException(java.text.ParseException) MetadataStore(loci.formats.meta.MetadataStore) Length(ome.units.quantity.Length) RandomAccessInputStream(loci.common.RandomAccessInputStream)

Example 38 with CoreMetadata

use of loci.formats.CoreMetadata in project bioformats by openmicroscopy.

the class HISReader method initFile.

// -- Internal FormatReader API methods --
/* @see loci.formats.FormatReader#initFile(String) */
@Override
protected void initFile(String id) throws FormatException, IOException {
    super.initFile(id);
    in = new RandomAccessInputStream(id);
    in.order(true);
    in.skipBytes(14);
    int nSeries = in.readShort();
    pixelOffset = new long[nSeries];
    String[] date = new String[nSeries];
    String[] binning = new String[nSeries];
    double[] offset = new double[nSeries];
    double[] exposureTime = new double[nSeries];
    boolean adjustedBitDepth = false;
    in.seek(0);
    core.clear();
    for (int i = 0; i < nSeries; i++) {
        CoreMetadata ms = new CoreMetadata();
        core.add(ms);
        String checkString = in.readString(2);
        if (!checkString.equals("IM") && i > 0) {
            if (getBitsPerPixel() == 12) {
                core.get(i - 1).bitsPerPixel = 16;
                int prevSkip = (getSizeX() * getSizeY() * getSizeC() * 12) / 8;
                int totalBytes = FormatTools.getPlaneSize(this);
                in.skipBytes(totalBytes - prevSkip);
                adjustedBitDepth = true;
            }
        }
        setSeries(i);
        int commentBytes = in.readShort();
        ms.sizeX = in.readShort();
        ms.sizeY = in.readShort();
        in.skipBytes(4);
        int dataType = in.readShort();
        switch(dataType) {
            case 1:
                ms.pixelType = FormatTools.UINT8;
                break;
            case 2:
                ms.pixelType = FormatTools.UINT16;
                break;
            case 6:
                ms.pixelType = FormatTools.UINT16;
                ms.bitsPerPixel = adjustedBitDepth ? 16 : 12;
                break;
            case 11:
                ms.pixelType = FormatTools.UINT8;
                ms.sizeC = 3;
                break;
            case 12:
                ms.pixelType = FormatTools.UINT16;
                ms.sizeC = 3;
                break;
            case 14:
                ms.pixelType = FormatTools.UINT16;
                ms.sizeC = 3;
                ms.bitsPerPixel = adjustedBitDepth ? 16 : 12;
                break;
        }
        in.skipBytes(50);
        String comment = in.readString(commentBytes);
        if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
            String[] data = comment.split(";");
            for (String token : data) {
                int eq = token.indexOf('=');
                if (eq != -1) {
                    String key = token.substring(0, eq);
                    String value = token.substring(eq + 1);
                    addSeriesMeta(key, value);
                    if (key.equals("vDate")) {
                        date[i] = value;
                    } else if (key.equals("vTime")) {
                        date[i] += " " + value;
                        date[i] = DateTools.formatDate(date[i], "yyyy/MM/dd HH:mm:ss");
                    } else if (key.equals("vOffset")) {
                        offset[i] = Double.parseDouble(value);
                    } else if (key.equals("vBinX")) {
                        binning[i] = value;
                    } else if (key.equals("vBinY")) {
                        binning[i] += "x" + value;
                    } else if (key.equals("vExpTim1")) {
                        exposureTime[i] = Double.parseDouble(value) * 100;
                    }
                }
            }
        }
        pixelOffset[i] = in.getFilePointer();
        ms.littleEndian = true;
        if (ms.sizeC == 0)
            ms.sizeC = 1;
        ms.sizeT = 1;
        ms.sizeZ = 1;
        ms.imageCount = 1;
        ms.rgb = ms.sizeC > 1;
        ms.interleaved = isRGB();
        ms.dimensionOrder = "XYCZT";
        in.skipBytes((getSizeX() * getSizeY() * getSizeC() * getBitsPerPixel()) / 8);
    }
    MetadataStore store = makeFilterMetadata();
    MetadataTools.populatePixels(store, this, true);
    String instrumentID = MetadataTools.createLSID("Instrument", 0);
    store.setInstrumentID(instrumentID, 0);
    if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
        for (int i = 0; i < nSeries; i++) {
            store.setImageInstrumentRef(instrumentID, i);
            if (date[i] != null) {
                store.setImageAcquisitionDate(new Timestamp(date[i]), i);
            }
            store.setPlaneExposureTime(new Time(exposureTime[i], UNITS.SECOND), i, 0);
            String detectorID = MetadataTools.createLSID("Detector", 0, i);
            store.setDetectorID(detectorID, 0, i);
            store.setDetectorOffset(offset[i], 0, i);
            store.setDetectorType(getDetectorType("Other"), 0, i);
            store.setDetectorSettingsID(detectorID, i, 0);
            store.setDetectorSettingsBinning(getBinning(binning[i]), i, 0);
        }
    }
}
Also used : MetadataStore(loci.formats.meta.MetadataStore) Time(ome.units.quantity.Time) RandomAccessInputStream(loci.common.RandomAccessInputStream) CoreMetadata(loci.formats.CoreMetadata) Timestamp(ome.xml.model.primitives.Timestamp)

Example 39 with CoreMetadata

use of loci.formats.CoreMetadata in project bioformats by openmicroscopy.

the class HamamatsuVMSReader method initFile.

// -- Internal FormatReader API methods --
/* @see loci.formats.FormatReader#initFile(String) */
@Override
protected void initFile(String id) throws FormatException, IOException {
    super.initFile(id);
    in = new RandomAccessInputStream(id);
    IniParser parser = new IniParser();
    IniList layout = parser.parseINI(new BufferedReader(new InputStreamReader(in, Constants.ENCODING)));
    IniTable slideInfo = layout.getTable("Virtual Microscope Specimen");
    int nLayers = Integer.parseInt(slideInfo.get("NoLayers"));
    nRows = Integer.parseInt(slideInfo.get("NoJpegRows"));
    nCols = Integer.parseInt(slideInfo.get("NoJpegColumns"));
    String imageFile = slideInfo.get("ImageFile");
    mapFile = slideInfo.get("MapFile");
    String optimisationFile = slideInfo.get("OptimisationFile");
    macroFile = slideInfo.get("MacroImage");
    Double physicalWidth = new Double(slideInfo.get("PhysicalWidth"));
    Double physicalHeight = new Double(slideInfo.get("PhysicalHeight"));
    Double magnification = new Double(slideInfo.get("SourceLens"));
    Double macroWidth = new Double(slideInfo.get("PhysicalMacroWidth"));
    Double macroHeight = new Double(slideInfo.get("PhysicalMacroHeight"));
    for (String key : slideInfo.keySet()) {
        addGlobalMeta(key, slideInfo.get(key));
    }
    Location dir = new Location(id).getAbsoluteFile().getParentFile();
    if (imageFile != null) {
        imageFile = new Location(dir, imageFile).getAbsolutePath();
        files.add(imageFile);
    }
    tileFiles = new String[nLayers][nRows][nCols];
    tileFiles[0][0][0] = imageFile;
    for (int layer = 0; layer < nLayers; layer++) {
        for (int row = 0; row < nRows; row++) {
            for (int col = 0; col < nCols; col++) {
                String f = slideInfo.get("ImageFile(" + col + "," + row + ")");
                if (f != null) {
                    f = new Location(dir, f).getAbsolutePath();
                    tileFiles[layer][row][col] = f;
                    files.add(f);
                }
            }
        }
    }
    if (mapFile != null) {
        mapFile = new Location(dir, mapFile).getAbsolutePath();
        files.add(mapFile);
    }
    if (optimisationFile != null) {
        optimisationFile = new Location(dir, optimisationFile).getAbsolutePath();
        files.add(optimisationFile);
    }
    if (macroFile != null) {
        macroFile = new Location(dir, macroFile).getAbsolutePath();
        files.add(macroFile);
    }
    int seriesCount = 3;
    core.clear();
    for (int i = 0; i < seriesCount; i++) {
        String file = null;
        switch(i) {
            case 0:
                file = tileFiles[0][nRows - 1][nCols - 1];
                break;
            case 1:
                file = macroFile;
                break;
            case 2:
                file = mapFile;
                break;
        }
        int[] dims;
        try (RandomAccessInputStream s = new RandomAccessInputStream(file);
            JPEGTileDecoder decoder = new JPEGTileDecoder()) {
            dims = decoder.preprocess(s);
        }
        CoreMetadata m = new CoreMetadata();
        if (i == 0) {
            m.sizeX = (MAX_JPEG_SIZE * (nCols - 1)) + dims[0];
            m.sizeY = (MAX_JPEG_SIZE * (nRows - 1)) + dims[1];
        } else {
            m.sizeX = dims[0];
            m.sizeY = dims[1];
        }
        m.sizeZ = 1;
        m.sizeC = 3;
        m.sizeT = 1;
        m.rgb = true;
        m.imageCount = 1;
        m.dimensionOrder = "XYCZT";
        m.pixelType = FormatTools.UINT8;
        m.interleaved = m.sizeX > MAX_SIZE && m.sizeY > MAX_SIZE;
        m.thumbnail = i > 0;
        core.add(m);
    }
    CoreMetadata ms0 = core.get(0);
    MetadataStore store = makeFilterMetadata();
    MetadataTools.populatePixels(store, this);
    String path = new Location(currentId).getAbsoluteFile().getName();
    store.setImageName(path + " full resolution", 0);
    store.setImageName(path + " macro", 1);
    store.setImageName(path + " map", 2);
    if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
        Length sizeX = FormatTools.getPhysicalSizeX(physicalWidth / ms0.sizeX);
        Length sizeY = FormatTools.getPhysicalSizeY(physicalHeight / ms0.sizeY);
        Length macroSizeX = FormatTools.getPhysicalSizeX(macroWidth / core.get(1).sizeX);
        Length macroSizeY = FormatTools.getPhysicalSizeY(macroHeight / core.get(1).sizeY);
        if (sizeX != null) {
            store.setPixelsPhysicalSizeX(sizeX, 0);
        }
        if (sizeY != null) {
            store.setPixelsPhysicalSizeY(sizeY, 0);
        }
        if (macroSizeX != null) {
            store.setPixelsPhysicalSizeX(macroSizeX, 1);
        }
        if (macroSizeY != null) {
            store.setPixelsPhysicalSizeY(macroSizeY, 1);
        }
        String instrumentID = MetadataTools.createLSID("Instrument", 0);
        store.setInstrumentID(instrumentID, 0);
        store.setImageInstrumentRef(instrumentID, 0);
        String objectiveID = MetadataTools.createLSID("Objective", 0, 0);
        store.setObjectiveID(objectiveID, 0, 0);
        store.setObjectiveNominalMagnification(magnification, 0, 0);
        store.setObjectiveSettingsID(objectiveID, 0);
    }
}
Also used : IniParser(loci.common.IniParser) InputStreamReader(java.io.InputStreamReader) IniList(loci.common.IniList) CoreMetadata(loci.formats.CoreMetadata) MetadataStore(loci.formats.meta.MetadataStore) Length(ome.units.quantity.Length) IniTable(loci.common.IniTable) JPEGTileDecoder(loci.formats.codec.JPEGTileDecoder) BufferedReader(java.io.BufferedReader) RandomAccessInputStream(loci.common.RandomAccessInputStream) Location(loci.common.Location)

Example 40 with CoreMetadata

use of loci.formats.CoreMetadata in project bioformats by openmicroscopy.

the class I2IReader method initFile.

// -- Internal FormatReader API methods --
/* @see loci.formats.FormatReader#initFile(String) */
@Override
public void initFile(String id) throws FormatException, IOException {
    super.initFile(id);
    in = new RandomAccessInputStream(id);
    CoreMetadata m = core.get(0);
    char pixelType = (char) in.readByte();
    switch(pixelType) {
        case 'I':
            m.pixelType = FormatTools.INT16;
            break;
        case 'R':
            m.pixelType = FormatTools.FLOAT;
            break;
        case 'C':
            throw new FormatException("Complex pixel data not yet supported");
        default:
            throw new FormatException("Invalid pixel type: " + pixelType);
    }
    if ((char) in.readByte() != ' ') {
        throw new FormatException("Expected space after pixel type character");
    }
    m.sizeX = getDimension(in);
    m.sizeY = getDimension(in);
    m.sizeZ = getDimension(in);
    m.littleEndian = (char) in.readByte() != 'B';
    in.order(isLittleEndian());
    short minPixelValue = in.readShort();
    short maxPixelValue = in.readShort();
    short xCoordinate = in.readShort();
    short yCoordinate = in.readShort();
    int n = in.readShort();
    // reserved for future use
    in.skipBytes(33);
    for (int i = 0; i < 15; i++) {
        String history = in.readString(64);
        addGlobalMetaList("Image history", history.trim());
    }
    addGlobalMeta("Minimum intensity value", minPixelValue);
    addGlobalMeta("Maximum intensity value", maxPixelValue);
    addGlobalMeta("Image position X", xCoordinate);
    addGlobalMeta("Image position Y", yCoordinate);
    // needs to be adjusted to reflect the true Z count
    if (n > 0) {
        m.sizeZ /= n;
    }
    // the user defines what the N dimension means
    // in practice, it could be timepoints, channels, etc. but we have no
    // way of knowing based on the file metadata
    m.sizeT = n;
    m.imageCount = getSizeZ() * getSizeT();
    m.sizeC = 1;
    m.rgb = false;
    m.dimensionOrder = "XYZTC";
    MetadataStore store = makeFilterMetadata();
    MetadataTools.populatePixels(store, this);
}
Also used : MetadataStore(loci.formats.meta.MetadataStore) RandomAccessInputStream(loci.common.RandomAccessInputStream) CoreMetadata(loci.formats.CoreMetadata) FormatException(loci.formats.FormatException)

Aggregations

CoreMetadata (loci.formats.CoreMetadata)211 MetadataStore (loci.formats.meta.MetadataStore)130 RandomAccessInputStream (loci.common.RandomAccessInputStream)108 FormatException (loci.formats.FormatException)87 Length (ome.units.quantity.Length)74 Location (loci.common.Location)55 ArrayList (java.util.ArrayList)50 Timestamp (ome.xml.model.primitives.Timestamp)44 IFD (loci.formats.tiff.IFD)33 Time (ome.units.quantity.Time)30 IOException (java.io.IOException)21 TiffParser (loci.formats.tiff.TiffParser)19 PhotoInterp (loci.formats.tiff.PhotoInterp)17 NonNegativeInteger (ome.xml.model.primitives.NonNegativeInteger)16 IFDList (loci.formats.tiff.IFDList)15 DependencyException (loci.common.services.DependencyException)14 ServiceFactory (loci.common.services.ServiceFactory)13 PositiveInteger (ome.xml.model.primitives.PositiveInteger)13 IniList (loci.common.IniList)9 HashMap (java.util.HashMap)8