private int convertPixelType(int type) throws FormatException { boolean signed = type % 2 == 1; int bytes = (type / 2) + (signed ? 1 : 0); return FormatTools.pixelTypeFromBytes(bytes, signed, false); }
private int convertPixelType(int type) throws FormatException { boolean signed = type % 2 == 1; int bytes = (type / 2) + (signed ? 1 : 0); return FormatTools.pixelTypeFromBytes(bytes, signed, false); }
private void parseFrameProperties(Element root) throws FormatException { CoreMetadata m = core.get(0); Element imageDefinition = getFirstChild(root, "commonframe:imageDefinition"); if (imageDefinition != null) { Element width = getFirstChild(imageDefinition, "base:width"); Element height = getFirstChild(imageDefinition, "base:height"); Element depth = getFirstChild(imageDefinition, "base:depth"); Element bitCount = getFirstChild(imageDefinition, "base:bitCounts"); if (width != null) { m.sizeX = Integer.parseInt(width.getTextContent()); } if (height != null) { m.sizeY = Integer.parseInt(height.getTextContent()); } if (depth != null) { int bytes = Integer.parseInt(depth.getTextContent()); m.pixelType = FormatTools.pixelTypeFromBytes(bytes, false, false); } if (bitCount != null) { m.bitsPerPixel = Integer.parseInt(bitCount.getTextContent()); } } Element general = getFirstChild(root, "commonframe:general"); if (general != null) { Element name = getFirstChild(general, "base:name"); if (name != null) { baseName = name.getTextContent(); } } }
private void parseFrameProperties(Element root) throws FormatException { CoreMetadata m = core.get(0); Element imageDefinition = getFirstChild(root, "commonframe:imageDefinition"); if (imageDefinition != null) { Element width = getFirstChild(imageDefinition, "base:width"); Element height = getFirstChild(imageDefinition, "base:height"); Element depth = getFirstChild(imageDefinition, "base:depth"); Element bitCount = getFirstChild(imageDefinition, "base:bitCounts"); if (width != null) { m.sizeX = Integer.parseInt(width.getTextContent()); } if (height != null) { m.sizeY = Integer.parseInt(height.getTextContent()); } if (depth != null) { int bytes = Integer.parseInt(depth.getTextContent()); m.pixelType = FormatTools.pixelTypeFromBytes(bytes, false, false); } if (bitCount != null) { m.bitsPerPixel = Integer.parseInt(bitCount.getTextContent()); } } Element general = getFirstChild(root, "commonframe:general"); if (general != null) { Element name = getFirstChild(general, "base:name"); if (name != null) { baseName = name.getTextContent(); } } }
boolean signed = bits != 8; bits = Math.abs(bits) / 8; m.pixelType = FormatTools.pixelTypeFromBytes(bits, signed, fp);
boolean signed = bits != 8; bits = Math.abs(bits) / 8; m.pixelType = FormatTools.pixelTypeFromBytes(bits, signed, fp);
m.pixelType = FormatTools.pixelTypeFromBytes(bits / 8, false, false);
m.pixelType = FormatTools.pixelTypeFromBytes(bits / 8, false, false);
@Override protected void initFile(String id) throws FormatException, IOException { super.initFile(id); in = new RandomAccessInputStream(id); CoreMetadata m = core.get(0); in.seek(348); m.sizeX = in.readInt(); m.sizeY = in.readInt(); in.skipBytes(4); int bpp = in.readInt(); addGlobalMeta("Bytes per pixel", bpp); m.pixelType = FormatTools.pixelTypeFromBytes(bpp, false, bpp == 4); m.littleEndian = false; m.sizeZ = 1; m.sizeC = 1; m.sizeT = 1; m.imageCount = 1; m.rgb = false; m.interleaved = false; m.dimensionOrder = "XYZCT"; MetadataStore store = makeFilterMetadata(); MetadataTools.populatePixels(store, this); }
@Override protected void initFile(String id) throws FormatException, IOException { super.initFile(id); in = new RandomAccessInputStream(id); CoreMetadata m = core.get(0); in.seek(348); m.sizeX = in.readInt(); m.sizeY = in.readInt(); in.skipBytes(4); int bpp = in.readInt(); addGlobalMeta("Bytes per pixel", bpp); m.pixelType = FormatTools.pixelTypeFromBytes(bpp, false, bpp == 4); m.littleEndian = false; m.sizeZ = 1; m.sizeC = 1; m.sizeT = 1; m.imageCount = 1; m.rgb = false; m.interleaved = false; m.dimensionOrder = "XYZCT"; MetadataStore store = makeFilterMetadata(); MetadataTools.populatePixels(store, this); }
@Override protected void initFile(String id) throws FormatException, IOException { super.initFile(id); in = new RandomAccessInputStream(id); CoreMetadata m = core.get(0); m.littleEndian = false; in.order(isLittleEndian()); m.sizeX = in.readShort(); m.sizeY = in.readShort(); m.sizeZ = in.readShort(); long fileLength = in.length() - HEADER_SIZE; int nBytes = (int) (fileLength / (getSizeX() * getSizeY() * getSizeZ())); m.pixelType = FormatTools.pixelTypeFromBytes(nBytes, false, false); m.sizeC = 1; m.sizeT = 1; m.rgb = false; m.dimensionOrder = "XYZCT"; m.imageCount = getSizeZ() * getSizeC() * getSizeT(); MetadataStore store = makeFilterMetadata(); MetadataTools.populatePixels(store, this); }
@Override protected void initFile(String id) throws FormatException, IOException { super.initFile(id); in = new RandomAccessInputStream(id); CoreMetadata m = core.get(0); m.littleEndian = false; in.order(isLittleEndian()); m.sizeX = in.readShort(); m.sizeY = in.readShort(); m.sizeZ = in.readShort(); long fileLength = in.length() - HEADER_SIZE; int nBytes = (int) (fileLength / (getSizeX() * getSizeY() * getSizeZ())); m.pixelType = FormatTools.pixelTypeFromBytes(nBytes, false, false); m.sizeC = 1; m.sizeT = 1; m.rgb = false; m.dimensionOrder = "XYZCT"; m.imageCount = getSizeZ() * getSizeC() * getSizeT(); MetadataStore store = makeFilterMetadata(); MetadataTools.populatePixels(store, this); }
ms.pixelType = FormatTools.pixelTypeFromBytes(bytes, false, true); ms.imageCount = ms.sizeZ * ms.sizeT; if (!ms.rgb) ms.imageCount *= ms.sizeC;
ms.pixelType = FormatTools.pixelTypeFromBytes(bytes, false, true); ms.imageCount = ms.sizeZ * ms.sizeT; if (!ms.rgb) ms.imageCount *= ms.sizeC;
bits /= 3; m.pixelType = FormatTools.pixelTypeFromBytes(bits / 8, false, false);
bits /= 3; m.pixelType = FormatTools.pixelTypeFromBytes(bits / 8, false, false);
m.pixelType = FormatTools.pixelTypeFromBytes(bpp, false, false);
m.pixelType = FormatTools.pixelTypeFromBytes(bpp, false, false);
int bytes = b.length / (getSizeX() * getSizeY()); m.pixelType = FormatTools.pixelTypeFromBytes(bytes, false, false); break;
int bytes = b.length / (getSizeX() * getSizeY()); m.pixelType = FormatTools.pixelTypeFromBytes(bytes, false, false); break;