use of ome.units.quantity.Length in project bioformats by openmicroscopy.
the class DeltavisionReader method initPixels.
protected void initPixels() throws FormatException, IOException {
LOGGER.info("Reading header");
MetadataStore store = makeFilterMetadata();
in.seek(96);
in.order(true);
boolean little = in.readShort() == LITTLE_ENDIAN;
in.order(little);
in.seek(0);
int sizeX = in.readInt();
int sizeY = in.readInt();
int imageCount = in.readInt();
int filePixelType = in.readInt();
in.seek(180);
int rawSizeT = in.readUnsignedShort();
int sizeT = rawSizeT == 0 ? 1 : rawSizeT;
int sequence = in.readShort();
in.seek(92);
extSize = in.readInt();
in.seek(196);
int rawSizeC = in.readShort();
int sizeC = rawSizeC == 0 ? 1 : rawSizeC;
// --- compute some secondary values ---
String imageSequence = getImageSequence(sequence);
int sizeZ = imageCount / (sizeC * sizeT);
// --- populate core metadata ---
LOGGER.info("Populating core metadata");
CoreMetadata m = core.get(0);
m.littleEndian = little;
m.sizeX = sizeX;
m.sizeY = sizeY;
m.imageCount = imageCount;
String pixel = getPixelString(filePixelType);
m.pixelType = getPixelType(filePixelType);
m.dimensionOrder = "XY" + imageSequence.replaceAll("W", "C");
int planeSize = getSizeX() * getSizeY() * FormatTools.getBytesPerPixel(getPixelType());
int realPlaneCount = (int) ((in.length() - HEADER_LENGTH - extSize) / planeSize);
if (realPlaneCount < getImageCount() && !truncatedFileFlag) {
LOGGER.debug("Truncated file");
m.imageCount = realPlaneCount;
if (sizeZ == 1) {
sizeT = realPlaneCount / sizeC;
} else if (sizeT == 1) {
sizeZ = realPlaneCount / sizeC;
if ((realPlaneCount % sizeC) != 0) {
sizeZ++;
m.imageCount = sizeZ * sizeC;
}
} else if (getDimensionOrder().indexOf('Z') < getDimensionOrder().indexOf('T')) {
sizeZ = realPlaneCount / (sizeC * sizeT);
if (sizeZ == 0) {
sizeT = 1;
sizeZ = realPlaneCount / sizeC;
if ((realPlaneCount % sizeC) != 0) {
sizeZ++;
m.imageCount = sizeZ * sizeC;
}
}
if (getImageCount() > (sizeZ * sizeC * sizeT)) {
m.imageCount = imageCount;
sizeC = rawSizeC == 0 ? 1 : rawSizeC;
sizeT = rawSizeT == 0 ? 1 : rawSizeT;
sizeZ = getImageCount() / (sizeC * sizeT);
}
} else {
sizeT = realPlaneCount / (sizeC * sizeZ);
}
}
m.sizeT = sizeT;
m.sizeC = sizeC;
m.sizeZ = sizeZ;
m.rgb = false;
m.interleaved = false;
m.metadataComplete = true;
m.indexed = false;
m.falseColor = false;
// --- parse extended header ---
in.seek(128);
numIntsPerSection = in.readShort();
numFloatsPerSection = in.readShort();
LOGGER.info("Reading extended header");
setOffsetInfo(sequence, getSizeZ(), getSizeC(), getSizeT());
extHdrFields = new DVExtHdrFields[getSizeZ()][getSizeC()][getSizeT()];
ndFilters = new Double[getSizeC()];
final List<Length> uniqueTileX = new ArrayList<Length>();
final List<Length> uniqueTileY = new ArrayList<Length>();
// Run through every image and fill in the
// Extended Header information array for that image
int offset = HEADER_LENGTH + numIntsPerSection * 4;
boolean hasZeroX = false;
boolean hasZeroY = false;
for (int i = 0; i < getImageCount(); i++) {
int[] coords = getZCTCoords(i);
int z = coords[0];
int w = coords[1];
int t = coords[2];
// -- read in the extended header data --
in.seek(offset + getTotalOffset(z, w, t));
DVExtHdrFields hdr = new DVExtHdrFields(in);
extHdrFields[z][w][t] = hdr;
if (!uniqueTileX.contains(hdr.stageXCoord) && hdr.stageXCoord.value().floatValue() != 0) {
uniqueTileX.add(hdr.stageXCoord);
} else if (hdr.stageXCoord.value().floatValue() == 0) {
hasZeroX = true;
}
if (!uniqueTileY.contains(hdr.stageYCoord) && hdr.stageYCoord.value().floatValue() != 0) {
uniqueTileY.add(hdr.stageYCoord);
} else if (hdr.stageYCoord.value().floatValue() == 0) {
hasZeroY = true;
}
}
xTiles = uniqueTileX.size();
yTiles = uniqueTileY.size();
if (xTiles > 1 || yTiles > 1) {
if (hasZeroX) {
xTiles++;
}
if (hasZeroY) {
yTiles++;
}
}
if (yTiles > 1) {
// TODO: use compareTo once Length implements Comparable
final Number y0 = uniqueTileY.get(0).value(UNITS.REFERENCEFRAME);
final Number y1 = uniqueTileY.get(1).value(UNITS.REFERENCEFRAME);
if (y1.floatValue() < y0.floatValue()) {
backwardsStage = true;
}
}
int nStagePositions = xTiles * yTiles;
if (nStagePositions > 0 && nStagePositions <= getSizeT()) {
int t = getSizeT();
m.sizeT /= nStagePositions;
if (getSizeT() * nStagePositions != t) {
m.sizeT = t;
nStagePositions = 1;
} else {
m.imageCount /= nStagePositions;
}
if (nStagePositions > 1) {
CoreMetadata originalCore = core.get(0);
core.clear();
for (int i = 0; i < nStagePositions; i++) {
core.add(originalCore);
}
}
}
lengths = new int[4];
int lengthIndex = 0;
int dimIndex = 0;
while (lengthIndex < lengths.length) {
char dim = imageSequence.charAt(dimIndex++);
switch(dim) {
case 'Z':
lengths[lengthIndex++] = getSizeZ();
break;
case 'W':
lengths[lengthIndex++] = getSizeC();
break;
case 'T':
lengths[lengthIndex++] = getSeriesCount();
lengths[lengthIndex++] = getSizeT();
break;
}
}
// --- populate original metadata ---
LOGGER.info("Populating original metadata");
addGlobalMeta("ImageWidth", sizeX);
addGlobalMeta("ImageHeight", sizeY);
addGlobalMeta("NumberOfImages", imageCount);
addGlobalMeta("PixelType", pixel);
addGlobalMeta("Number of timepoints", rawSizeT);
addGlobalMeta("Image sequence", imageSequence);
addGlobalMeta("Number of wavelengths", rawSizeC);
addGlobalMeta("Number of focal planes", sizeZ);
for (int series = 0; series < getSeriesCount(); series++) {
setSeries(series);
for (int plane = 0; plane < getImageCount(); plane++) {
int[] coords = getZCTCoords(plane);
int tIndex = getSeriesCount() * coords[2] + series;
DVExtHdrFields hdr = extHdrFields[coords[0]][coords[1]][tIndex];
// -- record original metadata --
String prefix = "Extended header Z" + coords[0] + " W" + coords[1] + " T" + coords[2];
for (Map.Entry<String, Object> entry : hdr.asMap().entrySet()) {
addSeriesMeta(prefix + ":" + entry.getKey(), entry.getValue());
}
addGlobalMetaList("X position for position", hdr.stageXCoord);
addGlobalMetaList("Y position for position", hdr.stageYCoord);
addGlobalMetaList("Z position for position", hdr.stageZCoord);
}
}
setSeries(0);
// --- populate OME metadata ---
LOGGER.info("Populating OME metadata");
MetadataTools.populatePixels(store, this, true);
// link Instrument and Image
String instrumentID = MetadataTools.createLSID("Instrument", 0);
store.setInstrumentID(instrumentID, 0);
for (int i = 0; i < getSeriesCount(); i++) {
store.setImageInstrumentRef(instrumentID, i);
}
}
use of ome.units.quantity.Length in project bioformats by openmicroscopy.
the class DeltavisionReader method populateObjective.
/**
* Populate an Objective based upon the lens ID.
* This is based upon information received from Applied Precision.
*/
private void populateObjective(MetadataStore store, int lensID) throws FormatException {
Double lensNA = null;
Double workingDistance = null;
Immersion immersion = getImmersion("Other");
Correction correction = getCorrection("Other");
String manufacturer = null;
String model = null;
double magnification = 0;
Double calibratedMagnification = null;
if (lensID >= 10000 && lensID <= 32000) {
if (lensID < 12000) {
manufacturer = "Olympus";
} else if (lensID < 14000) {
manufacturer = "Nikon";
} else if (lensID < 16000) {
manufacturer = "Zeiss";
} else if (lensID < 18000) {
manufacturer = "Leica";
} else if (lensID < 20000) {
manufacturer = "APLLC";
}
magnification = ((lensID % 1000) - (lensID % 100)) / 10.0;
if (magnification == 0) {
magnification = 100;
}
}
switch(lensID) {
case 2001:
lensNA = 1.15;
immersion = getImmersion("Water");
break;
case 10100:
lensNA = 0.30;
immersion = getImmersion("Air");
model = "1-LP134";
correction = getCorrection("Achromat");
break;
case 10101:
lensNA = 0.40;
immersion = getImmersion("Air");
model = "1-LB331";
correction = getCorrection("Apo");
break;
case 10102:
lensNA = 0.30;
immersion = getImmersion("Air");
model = "1-LP134";
break;
case 10103:
lensNA = 0.13;
calibratedMagnification = 4.0;
immersion = getImmersion("Air");
model = "1-LP124";
break;
case 10104:
lensNA = 0.40;
immersion = getImmersion("Air");
model = "1-LB331";
break;
case 10105:
lensNA = 0.40;
workingDistance = 3.10;
immersion = getImmersion("Air");
model = "1-LP331";
break;
case 10106:
lensNA = 0.16;
calibratedMagnification = 4.0;
workingDistance = 13.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "1-UB822";
break;
case 10107:
lensNA = 0.40;
immersion = getImmersion("Air");
workingDistance = 3.10;
model = "1-UB823";
correction = getCorrection("PlanApo");
break;
case 10108:
lensNA = 0.25;
workingDistance = 9.8;
immersion = getImmersion("Air");
model = "1-UC243";
break;
case 10109:
lensNA = 0.30;
immersion = getImmersion("Air");
model = "1-UB532";
correction = getCorrection("PlanFluor");
break;
case 10110:
lensNA = 0.13;
calibratedMagnification = 4.0;
immersion = getImmersion("Air");
break;
case 10111:
lensNA = 0.08;
calibratedMagnification = 2.0;
immersion = getImmersion("Air");
break;
case 10112:
lensNA = 0.13;
calibratedMagnification = 4.0;
immersion = getImmersion("Air");
model = "1-UB522";
break;
case 10113:
lensNA = 0.04;
calibratedMagnification = 1.25;
workingDistance = 5.1;
immersion = getImmersion("Air");
model = "1-UB920";
correction = getCorrection("PlanApo");
break;
case 10114:
lensNA = 0.08;
calibratedMagnification = 2.0;
workingDistance = 6.0;
immersion = getImmersion("Air");
model = "1-UB921";
correction = getCorrection("PlanApo");
break;
case 10200:
lensNA = 0.40;
workingDistance = 3.0;
immersion = getImmersion("Air");
break;
case 10201:
lensNA = 0.65;
workingDistance = 1.03;
immersion = getImmersion("Air");
model = "1-LB343";
correction = getCorrection("Apo");
break;
case 10202:
lensNA = 0.40;
immersion = getImmersion("Air");
model = "1-LP146";
break;
case 10203:
lensNA = 0.80;
immersion = getImmersion("Oil");
model = "1-LB342";
correction = getCorrection("PlanApo");
break;
case 10204:
lensNA = 0.70;
immersion = getImmersion("Air");
model = "1-LB341";
break;
case 10205:
lensNA = 0.75;
workingDistance = 0.55;
immersion = getImmersion("Air");
model = "1-UB765";
correction = getCorrection("Apo");
break;
case 10206:
lensNA = 0.50;
workingDistance = 0.55;
immersion = getImmersion("Air");
model = "1-UC525";
break;
case 10207:
lensNA = 0.40;
workingDistance = 3.0;
immersion = getImmersion("Air");
model = "1-UC145";
correction = getCorrection("Achromat");
break;
case 10208:
lensNA = 0.50;
workingDistance = 0.55;
immersion = getImmersion("Air");
model = "1-UB525";
break;
case 10209:
lensNA = 0.40;
workingDistance = 6.9;
immersion = getImmersion("Air");
model = "1-UC345";
break;
case 10210:
lensNA = 0.40;
workingDistance = 6.9;
immersion = getImmersion("Air");
model = "1-UB345";
break;
case 10400:
lensNA = 0.55;
workingDistance = 2.04;
immersion = getImmersion("Air");
break;
case 10401:
lensNA = 0.85;
workingDistance = 0.25;
immersion = getImmersion("Air");
break;
case 10402:
lensNA = 1.30;
workingDistance = 0.12;
immersion = getImmersion("Oil");
model = "1-LB356";
break;
case 10403:
lensNA = 1.35;
workingDistance = 0.10;
immersion = getImmersion("Oil");
model = "1-UB768";
break;
case 10404:
lensNA = 0.85;
workingDistance = 0.20;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "1-UB827";
break;
case 10405:
lensNA = 0.95;
workingDistance = 0.14;
immersion = getImmersion("Air");
model = "1-UB927";
correction = getCorrection("PlanApo");
break;
case 10406:
lensNA = 1.0;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "1-UB828";
break;
case 10407:
lensNA = 0.75;
correction = getCorrection("PlanFluor");
immersion = getImmersion("Air");
model = "1-UB527";
break;
case 10408:
lensNA = 0.60;
workingDistance = 2.15;
immersion = getImmersion("Air");
model = "1-UB347";
break;
case 10409:
lensNA = 0.60;
workingDistance = 2.15;
immersion = getImmersion("Air");
model = "1-UC347";
break;
case 10410:
lensNA = 1.15;
immersion = getImmersion("Water");
model = "1-UB769";
break;
case 10411:
lensNA = 0.75;
immersion = getImmersion("Air");
model = "1-UC527";
correction = getCorrection("PlanFluor");
break;
case 10412:
lensNA = 1.34;
workingDistance = 0.10;
immersion = getImmersion("Oil");
correction = getCorrection("Apo");
break;
case 10000:
lensNA = 1.30;
correction = getCorrection("Apo");
immersion = getImmersion("Oil");
model = "1-LB393";
break;
case 10001:
lensNA = 1.30;
immersion = getImmersion("Oil");
model = "1-LB392";
break;
case 10002:
lensNA = 1.40;
workingDistance = 0.10;
immersion = getImmersion("Oil");
model = "1-UB935";
correction = getCorrection("PlanApo");
break;
case 10003:
lensNA = 1.35;
workingDistance = 0.10;
immersion = getImmersion("Oil");
model = "1-UB836";
correction = getCorrection("PlanApo");
break;
case 10004:
lensNA = 1.30;
immersion = getImmersion("Oil");
model = "1-UB535";
break;
case 10005:
lensNA = 1.35;
workingDistance = 0.10;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
break;
case 10006:
lensNA = 1.40;
workingDistance = 0.10;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
break;
case 10007:
lensNA = 1.40;
workingDistance = 0.13;
immersion = getImmersion("Oil");
;
model = "1-U2B836";
break;
case 10600:
lensNA = 1.40;
workingDistance = 0.30;
immersion = getImmersion("Oil");
break;
case 10601:
lensNA = 1.40;
immersion = getImmersion("Oil");
model = "1-LB751";
break;
case 10602:
lensNA = 1.40;
workingDistance = 0.1;
immersion = getImmersion("Oil");
model = "1-UB932";
correction = getCorrection("PlanApo");
break;
case 10603:
lensNA = 1.20;
workingDistance = 0.25;
immersion = getImmersion("Water");
model = "1-UB891";
break;
case 10604:
lensNA = 1.20;
workingDistance = 0.25;
immersion = getImmersion("Water");
break;
case 10605:
lensNA = 0.70;
workingDistance = 1.10;
immersion = getImmersion("Air");
model = "1-UB351";
break;
case 10606:
lensNA = 0.70;
workingDistance = 1.10;
immersion = getImmersion("Air");
model = "1-UC351";
break;
case 10607:
lensNA = 1.40;
immersion = getImmersion("Oil");
model = "1-UC932";
correction = getCorrection("PlanApo");
break;
case 10608:
lensNA = 1.25;
immersion = getImmersion("Oil");
model = "1-UB532";
break;
case 10609:
lensNA = 1.40;
workingDistance = 0.15;
immersion = getImmersion("Oil");
model = "1-UB933";
correction = getCorrection("PlanApo");
break;
case 10610:
lensNA = 1.40;
workingDistance = 0.15;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
break;
case 10611:
lensNA = 1.20;
workingDistance = 0.25;
immersion = getImmersion("Water");
correction = getCorrection("PlanApo");
break;
case 10612:
lensNA = 1.42;
workingDistance = 0.15;
immersion = getImmersion("Oil");
model = "1-U2B933";
correction = getCorrection("PlanApo");
break;
case 12201:
lensNA = 0.75;
immersion = getImmersion("Air");
correction = getCorrection("PlanFluor");
model = "93146";
break;
case 12203:
lensNA = 0.45;
workingDistance = 8.1;
immersion = getImmersion("Air");
correction = getCorrection("PlanFluor");
model = "93150";
break;
case 12204:
lensNA = 0.45;
workingDistance = 4.50;
immersion = getImmersion("Air");
model = "MUE01200/92777";
break;
case 12205:
lensNA = 0.50;
workingDistance = 2.10;
immersion = getImmersion("Air");
correction = getCorrection("PlanFluor");
model = "MRH00200/93135";
break;
case 12401:
lensNA = 1.30;
workingDistance = 0.16;
immersion = getImmersion("Oil");
model = "85028";
break;
case 12402:
lensNA = 1.30;
workingDistance = 0.22;
immersion = getImmersion("Oil");
model = "85004";
break;
case 12403:
lensNA = 0.75;
immersion = getImmersion("Air");
model = "140508";
break;
case 12404:
lensNA = 1.30;
workingDistance = 0.22;
immersion = getImmersion("Oil");
break;
case 12405:
lensNA = 0.95;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "93105";
break;
case 12406:
lensNA = 1.00;
workingDistance = 0.16;
immersion = getImmersion("Oil");
model = "93106";
break;
case 12600:
lensNA = 1.40;
workingDistance = 0.17;
immersion = getImmersion("Oil");
model = "85020";
break;
case 12601:
lensNA = 1.40;
workingDistance = 0.21;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "93108";
break;
case 12602:
lensNA = 1.20;
workingDistance = 0.22;
immersion = getImmersion("Water");
correction = getCorrection("PlanApo");
model = "93109";
break;
case 12000:
lensNA = 1.40;
workingDistance = 0.1;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "85025";
break;
case 12001:
lensNA = 1.30;
workingDistance = 0.14;
immersion = getImmersion("Oil");
model = "85005";
break;
case 12002:
lensNA = 1.30;
workingDistance = 0.14;
immersion = getImmersion("Oil");
correction = getCorrection("UV");
model = "85005";
break;
case 12003:
lensNA = 1.40;
workingDistance = 0.13;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "93110";
break;
case 12004:
lensNA = 1.30;
workingDistance = 0.20;
immersion = getImmersion("Oil");
model = "93129";
break;
case 12101:
lensNA = 0.10;
calibratedMagnification = 2.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "202294";
break;
case 12102:
lensNA = 0.20;
calibratedMagnification = 4.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "108388";
break;
case 12103:
lensNA = 0.2;
calibratedMagnification = 4.0;
workingDistance = 15.7;
correction = getCorrection("PlanApo");
immersion = getImmersion("Air");
model = "93102";
break;
case 12104:
lensNA = 0.45;
workingDistance = 4.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "93103";
break;
case 12105:
lensNA = 0.30;
workingDistance = 16.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanFluor");
model = "93134";
break;
case 12106:
lensNA = 0.50;
workingDistance = 1.20;
immersion = getImmersion("Air");
correction = getCorrection("SuperFluor");
model = "93126";
break;
case 12107:
lensNA = 0.25;
workingDistance = 10.5;
immersion = getImmersion("Air");
model = "93183";
break;
case 12108:
lensNA = 0.25;
workingDistance = 6.10;
immersion = getImmersion("Air");
correction = getCorrection("Achromat");
model = "93161";
break;
case 14001:
lensNA = 1.40;
workingDistance = 0.1;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "44 07 08 (02)";
break;
case 14002:
lensNA = 1.30;
workingDistance = 0.1;
immersion = getImmersion("Oil");
model = "44 07 86";
break;
case 14003:
lensNA = 1.40;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "44 07 80 (02)";
break;
case 14004:
lensNA = 1.30;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "46 19 46 - 9903";
break;
case 14005:
lensNA = 1.40;
immersion = getImmersion("Oil");
model = "44 07 86 (02)";
break;
case 14006:
lensNA = 1.30;
immersion = getImmersion("Oil");
break;
case 14601:
lensNA = 1.40;
calibratedMagnification = 63.0;
workingDistance = 0.09;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "44 07 60 (03)";
break;
case 14602:
lensNA = 1.40;
calibratedMagnification = 63.0;
workingDistance = 0.09;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "44 07 62 (02)";
break;
case 14603:
lensNA = 0.90;
calibratedMagnification = 63.0;
immersion = getImmersion("Water");
model = "44 00 69";
break;
case 14604:
lensNA = 1.20;
workingDistance = 0.09;
calibratedMagnification = 63.0;
immersion = getImmersion("Water");
model = "44 06 68";
break;
case 14401:
lensNA = 1.30;
workingDistance = 0.14;
immersion = getImmersion("Oil");
correction = getCorrection("Fluar");
model = "44 02 55 (01)";
break;
case 14402:
lensNA = 1.00;
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
model = "44 07 51";
break;
case 14403:
lensNA = 1.20;
immersion = getImmersion("Water");
correction = getCorrection("Apo");
model = "44 00 52";
break;
case 14404:
lensNA = 0.75;
immersion = getImmersion("Air");
correction = getCorrection("PlanNeofluar");
model = "44 03 51";
break;
case 14405:
lensNA = 1.30;
workingDistance = 0.15;
immersion = getImmersion("Oil");
correction = getCorrection("PlanNeofluar");
model = "44 04 50";
break;
case 14406:
lensNA = 0.60;
immersion = getImmersion("Air");
model = "44 08 65";
break;
case 14407:
lensNA = 1.30;
immersion = getImmersion("Air");
correction = getCorrection("PlanNeofluar");
break;
case 14301:
lensNA = 0.80;
calibratedMagnification = 25.0;
workingDistance = 0.80;
correction = getCorrection("PlanNeofluar");
model = "44 05 44";
break;
case 14302:
lensNA = 0.80;
workingDistance = 0.80;
calibratedMagnification = 25.0;
correction = getCorrection("PlanNeofluar");
model = "44 05 42";
break;
case 14303:
lensNA = 0.80;
calibratedMagnification = 25.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanNeofluar");
model = "44 05 45";
break;
case 14201:
lensNA = 0.50;
immersion = getImmersion("Air");
correction = getCorrection("PlanNeofluar");
model = "44 03 41 (01)";
break;
case 14202:
lensNA = 0.60;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "44 06 40";
break;
case 14203:
lensNA = 0.75;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "44 06 49";
break;
case 14204:
lensNA = 0.75;
immersion = getImmersion("Air");
correction = getCorrection("Fluar");
model = "44 01 45";
break;
case 14101:
lensNA = 0.30;
immersion = getImmersion("Air");
correction = getCorrection("PlanNeofluar");
model = "44 03 30";
break;
case 14102:
lensNA = 0.25;
immersion = getImmersion("Air");
model = "44 01 31";
break;
case 14103:
lensNA = 0.25;
immersion = getImmersion("Air");
model = "44 00 31";
break;
case 14104:
lensNA = 0.45;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "44 06 39";
break;
case 14105:
lensNA = 0.16;
calibratedMagnification = 5.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
model = "44 06 20";
break;
case 18101:
lensNA = 0.20;
workingDistance = 3.33;
calibratedMagnification = 4.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
break;
case 18102:
lensNA = 0.20;
workingDistance = 2.883;
calibratedMagnification = 2.46;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
break;
case 18103:
lensNA = 0.20;
workingDistance = 2.883;
calibratedMagnification = 4.0;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
break;
case 18104:
lensNA = 0.45;
calibratedMagnification = 6.15;
workingDistance = 2.883;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
break;
case 18105:
lensNA = 0.45;
workingDistance = 2.883;
immersion = getImmersion("Air");
correction = getCorrection("PlanApo");
break;
case 18106:
lensNA = 0.1;
workingDistance = 24.00;
calibratedMagnification = 1.0;
immersion = getImmersion("Air");
break;
case 18201:
lensNA = 0.55;
workingDistance = 13.00;
immersion = getImmersion("Air");
break;
case 18202:
lensNA = 0.50;
workingDistance = 13.00;
immersion = getImmersion("Air");
break;
case 18204:
lensNA = 0.45;
workingDistance = 4.50;
immersion = getImmersion("Air");
model = "MUE01200/92777";
break;
case 18205:
lensNA = 0.50;
workingDistance = 2.10;
immersion = getImmersion("Air");
model = "MRH00200/93135";
break;
case 1:
lensNA = 0.25;
manufacturer = "Zeiss";
calibratedMagnification = 10.0;
immersion = getImmersion("Air");
break;
case 2:
lensNA = 0.50;
manufacturer = "Zeiss";
calibratedMagnification = 25.0;
immersion = getImmersion("Air");
break;
case 3:
lensNA = 1.00;
manufacturer = "Zeiss";
calibratedMagnification = 50.0;
immersion = getImmersion("Oil");
break;
case 4:
lensNA = 1.25;
manufacturer = "Zeiss";
calibratedMagnification = 63.0;
immersion = getImmersion("Oil");
break;
case 5:
lensNA = 1.30;
manufacturer = "Zeiss";
calibratedMagnification = 100.0;
immersion = getImmersion("Oil");
break;
case 6:
lensNA = 1.30;
calibratedMagnification = 100.0;
correction = getCorrection("Neofluor");
immersion = getImmersion("Oil");
break;
case 7:
lensNA = 1.40;
calibratedMagnification = 63.0;
manufacturer = "Leitz";
immersion = getImmersion("Oil");
correction = getCorrection("PlanApo");
break;
case 8:
lensNA = 1.20;
calibratedMagnification = 63.0;
immersion = getImmersion("Water");
break;
case 9:
lensNA = 0.40;
workingDistance = 0.30;
calibratedMagnification = 10.0;
manufacturer = "Olympus";
immersion = getImmersion("Air");
break;
case 10:
lensNA = 0.80;
workingDistance = 0.30;
manufacturer = "Olympus";
calibratedMagnification = 20.0;
immersion = getImmersion("Oil");
break;
case 11:
lensNA = 1.30;
calibratedMagnification = 40.0;
manufacturer = "Olympus";
workingDistance = 0.30;
immersion = getImmersion("Oil");
break;
case 12:
lensNA = 1.40;
workingDistance = 0.30;
manufacturer = "Olympus";
calibratedMagnification = 60.0;
immersion = getImmersion("Oil");
break;
case 13:
lensNA = 1.40;
workingDistance = 0.30;
manufacturer = "Nikon";
calibratedMagnification = 100.0;
immersion = getImmersion("Oil");
break;
}
String objectiveID = "Objective:" + lensID;
store.setObjectiveID(objectiveID, 0, 0);
for (int series = 0; series < getSeriesCount(); series++) {
store.setObjectiveSettingsID(objectiveID, series);
}
store.setObjectiveLensNA(lensNA, 0, 0);
store.setObjectiveImmersion(immersion, 0, 0);
store.setObjectiveCorrection(correction, 0, 0);
store.setObjectiveManufacturer(manufacturer, 0, 0);
store.setObjectiveModel(model, 0, 0);
store.setObjectiveNominalMagnification(magnification, 0, 0);
if (calibratedMagnification != null) {
store.setObjectiveCalibratedMagnification(calibratedMagnification, 0, 0);
}
if (workingDistance != null) {
store.setObjectiveWorkingDistance(new Length(workingDistance, UNITS.MILLIMETER), 0, 0);
}
}
use of ome.units.quantity.Length in project bioformats by openmicroscopy.
the class DeltavisionReader method initExtraMetadata.
protected void initExtraMetadata() throws FormatException, IOException {
MetadataStore store = makeFilterMetadata();
// --- read in the image header data ---
LOGGER.info("Reading header");
in.seek(16);
int subImageStartX = in.readInt();
int subImageStartY = in.readInt();
int subImageStartZ = in.readInt();
int pixelSamplingX = in.readInt();
int pixelSamplingY = in.readInt();
int pixelSamplingZ = in.readInt();
float pixX = in.readFloat();
float pixY = in.readFloat();
float pixZ = in.readFloat();
float xAxisAngle = in.readFloat();
float yAxisAngle = in.readFloat();
float zAxisAngle = in.readFloat();
int xAxisSeq = in.readInt();
int yAxisSeq = in.readInt();
int zAxisSeq = in.readInt();
float[] minWave = new float[5];
float[] maxWave = new float[5];
minWave[0] = in.readFloat();
maxWave[0] = in.readFloat();
float meanIntensity = in.readFloat();
int spaceGroupNumber = in.readInt();
in.seek(132);
short numSubResSets = in.readShort();
short zAxisReductionQuotient = in.readShort();
for (int i = 1; i <= 3; i++) {
minWave[i] = in.readFloat();
maxWave[i] = in.readFloat();
}
int type = in.readShort();
int lensID = in.readShort();
in.seek(172);
minWave[4] = in.readFloat();
maxWave[4] = in.readFloat();
in.seek(184);
float xTiltAngle = in.readFloat();
float yTiltAngle = in.readFloat();
float zTiltAngle = in.readFloat();
in.skipBytes(2);
short[] waves = new short[5];
for (int i = 0; i < waves.length; i++) {
waves[i] = in.readShort();
}
float xOrigin = in.readFloat();
float yOrigin = in.readFloat();
float zOrigin = in.readFloat();
in.skipBytes(4);
String[] title = new String[10];
for (int i = 0; i < title.length; i++) {
// Make sure that "null" characters are stripped out
title[i] = in.readByteToString(80).replaceAll("\0", "");
}
// --- compute some secondary values ---
String imageType = type < IMAGE_TYPES.length ? IMAGE_TYPES[type] : "unknown";
String imageDesc = title[0];
if (imageDesc != null && imageDesc.length() == 0)
imageDesc = null;
// --- populate original metadata ---
LOGGER.info("Populating original metadata");
addGlobalMeta("Sub-image starting point (X)", subImageStartX);
addGlobalMeta("Sub-image starting point (Y)", subImageStartY);
addGlobalMeta("Sub-image starting point (Z)", subImageStartZ);
addGlobalMeta("Pixel sampling size (X)", pixelSamplingX);
addGlobalMeta("Pixel sampling size (Y)", pixelSamplingY);
addGlobalMeta("Pixel sampling size (Z)", pixelSamplingZ);
addGlobalMeta("X element length (in um)", pixX);
addGlobalMeta("Y element length (in um)", pixY);
addGlobalMeta("Z element length (in um)", pixZ);
addGlobalMeta("X axis angle", xAxisAngle);
addGlobalMeta("Y axis angle", yAxisAngle);
addGlobalMeta("Z axis angle", zAxisAngle);
addGlobalMeta("Column axis sequence", xAxisSeq);
addGlobalMeta("Row axis sequence", yAxisSeq);
addGlobalMeta("Section axis sequence", zAxisSeq);
addGlobalMeta("Image Type", imageType);
addGlobalMeta("Lens ID Number", lensID);
addGlobalMeta("X axis tilt angle", xTiltAngle);
addGlobalMeta("Y axis tilt angle", yTiltAngle);
addGlobalMeta("Z axis tilt angle", zTiltAngle);
for (int i = 0; i < waves.length; i++) {
addGlobalMeta("Wavelength " + (i + 1) + " (in nm)", waves[i]);
}
addGlobalMeta("X origin (in um)", xOrigin);
addGlobalMeta("Y origin (in um)", yOrigin);
addGlobalMeta("Z origin (in um)", zOrigin);
for (String t : title) {
addGlobalMetaList("Title", t);
}
for (int i = 0; i < minWave.length; i++) {
addGlobalMeta("Wavelength " + (i + 1) + " min. intensity", minWave[i]);
addGlobalMeta("Wavelength " + (i + 1) + " max. intensity", maxWave[i]);
}
addGlobalMeta("Wavelength 1 mean intensity", meanIntensity);
addGlobalMeta("Space group number", spaceGroupNumber);
addGlobalMeta("Number of Sub-resolution sets", numSubResSets);
addGlobalMeta("Z axis reduction quotient", zAxisReductionQuotient);
// --- populate OME metadata ---
LOGGER.info("Populating OME metadata");
for (int series = 0; series < getSeriesCount(); series++) {
if (store instanceof IMinMaxStore) {
IMinMaxStore minMaxStore = (IMinMaxStore) store;
for (int i = 0; i < minWave.length; i++) {
if (i < getEffectiveSizeC()) {
minMaxStore.setChannelGlobalMinMax(i, minWave[i], maxWave[i], series);
}
}
}
Double x = new Double(pixX);
Length sizeX = FormatTools.getPhysicalSizeX(x);
if (sizeX != null) {
store.setPixelsPhysicalSizeX(sizeX, series);
}
Double y = new Double(pixY);
Length sizeY = FormatTools.getPhysicalSizeY(y);
if (sizeY != null) {
store.setPixelsPhysicalSizeY(sizeY, series);
}
Double z = new Double(pixZ);
Length sizeZ = FormatTools.getPhysicalSizeZ(z);
if (sizeZ != null) {
store.setPixelsPhysicalSizeZ(sizeZ, series);
}
store.setImageDescription(imageDesc, series);
}
populateObjective(store, lensID);
// if matching log file exists, extract key/value pairs from it
boolean logFound = isGroupFiles() ? parseLogFile(store) : false;
if (isGroupFiles())
parseDeconvolutionLog(store);
if (getSeriesCount() == 1) {
xTiles = 1;
yTiles = 1;
backwardsStage = false;
}
for (int series = 0; series < getSeriesCount(); series++) {
int seriesIndex = series;
if (backwardsStage) {
int x = series % xTiles;
int y = series / xTiles;
seriesIndex = (yTiles - y - 1) * xTiles + (xTiles - x - 1);
}
for (int i = 0; i < getImageCount(); i++) {
int[] coords = getZCTCoords(i);
int tIndex = getSeriesCount() * coords[2] + seriesIndex;
DVExtHdrFields hdr = extHdrFields[coords[0]][coords[1]][tIndex];
// plane timing
store.setPlaneDeltaT(new Time(new Double(hdr.timeStampSeconds), UNITS.SECOND), series, i);
store.setPlaneExposureTime(new Time(new Double(extHdrFields[0][coords[1]][0].expTime), UNITS.SECOND), series, i);
// stage position
if (!logFound || getSeriesCount() > 1) {
store.setPlanePositionX(hdr.stageXCoord, series, i);
store.setPlanePositionY(hdr.stageYCoord, series, i);
store.setPlanePositionZ(hdr.stageZCoord, series, i);
}
}
for (int w = 0; w < getSizeC(); w++) {
DVExtHdrFields hdrC = extHdrFields[0][w][series];
Length emission = FormatTools.getEmissionWavelength(new Double(waves[w]));
Length excitation = FormatTools.getExcitationWavelength(new Double(hdrC.exWavelen));
if (emission != null) {
store.setChannelEmissionWavelength(emission, series, w);
}
if (excitation != null) {
store.setChannelExcitationWavelength(excitation, series, w);
}
if (ndFilters[w] == null)
ndFilters[w] = new Double(hdrC.ndFilter);
store.setChannelNDFilter(ndFilters[w], series, w);
}
}
}
use of ome.units.quantity.Length in project bioformats by openmicroscopy.
the class FV1000Reader method parseROIFile.
private int parseROIFile(String filename, MetadataStore store, int nextROI, int plane) throws FormatException, IOException {
int[] coordinates = getZCTCoords(plane);
IniList roiFile = null;
try {
roiFile = getIniFile(filename);
} catch (FormatException e) {
LOGGER.debug("Could not parse ROI file {}", filename, e);
return nextROI;
} catch (IOException e) {
LOGGER.debug("Could not parse ROI file {}", filename, e);
return nextROI;
}
boolean validROI = false;
int shape = -1;
int shapeType = -1;
String[] xc = null, yc = null;
int divide = 0;
int fontSize = 0, lineWidth = 0, angle = 0;
String fontName = null, name = null;
for (IniTable table : roiFile) {
String tableName = table.get(IniTable.HEADER_KEY);
if (tableName.equals("ROIBase FileInformation")) {
try {
String roiName = table.get("Name").replaceAll("\"", "");
validROI = Integer.parseInt(roiName) > 1;
} catch (NumberFormatException e) {
validROI = false;
}
if (!validROI)
continue;
} else if (tableName.equals("ROIBase Body")) {
shapeType = Integer.parseInt(table.get("SHAPE"));
divide = Integer.parseInt(table.get("DIVIDE"));
String[] fontAttributes = table.get("FONT").split(",");
fontName = fontAttributes[0];
fontSize = Integer.parseInt(fontAttributes[1]);
Length font = FormatTools.getFontSize(fontSize);
lineWidth = Integer.parseInt(table.get("LINEWIDTH"));
name = table.get("NAME");
angle = Integer.parseInt(table.get("ANGLE"));
xc = table.get("X").split(",");
yc = table.get("Y").split(",");
int x = Integer.parseInt(xc[0]);
int width = xc.length > 1 ? Integer.parseInt(xc[1]) - x : 0;
int y = Integer.parseInt(yc[0]);
int height = yc.length > 1 ? Integer.parseInt(yc[1]) - y : 0;
if (width + x <= getSizeX() && height + y <= getSizeY()) {
shape++;
final Integer zIndex = coordinates[0];
final Integer tIndex = coordinates[2];
if (shape == 0) {
nextROI++;
if (shapeType == POINT || shapeType == GRID || shapeType == RECTANGLE || shapeType == LINE || shapeType == CIRCLE || shapeType == ELLIPSE || shapeType == POLYGON || shapeType == FREE_SHAPE || shapeType == POLYLINE || shapeType == FREE_LINE) {
String roiID = MetadataTools.createLSID("ROI", nextROI);
store.setROIID(roiID, nextROI);
store.setImageROIRef(roiID, 0, nextROI);
}
}
String shapeID = MetadataTools.createLSID("Shape", nextROI, shape);
if (shapeType == POINT) {
store.setPointID(shapeID, nextROI, shape);
store.setPointTheZ(new NonNegativeInteger(zIndex), nextROI, shape);
store.setPointTheT(new NonNegativeInteger(tIndex), nextROI, shape);
if (font != null) {
store.setPointFontSize(font, nextROI, shape);
}
Length l = new Length((double) lineWidth, UNITS.PIXEL);
store.setPointStrokeWidth(l, nextROI, shape);
store.setPointX(new Double(xc[0]), nextROI, shape);
store.setPointY(new Double(yc[0]), nextROI, shape);
} else if (shapeType == GRID || shapeType == RECTANGLE) {
if (shapeType == RECTANGLE)
divide = 1;
width /= divide;
height /= divide;
for (int row = 0; row < divide; row++) {
for (int col = 0; col < divide; col++) {
double realX = x + col * width;
double realY = y + row * height;
shapeID = MetadataTools.createLSID("Shape", nextROI, shape);
store.setRectangleID(shapeID, nextROI, shape);
store.setRectangleX(realX, nextROI, shape);
store.setRectangleY(realY, nextROI, shape);
store.setRectangleWidth((double) width, nextROI, shape);
store.setRectangleHeight((double) height, nextROI, shape);
store.setRectangleTheZ(new NonNegativeInteger(zIndex), nextROI, shape);
store.setRectangleTheT(new NonNegativeInteger(tIndex), nextROI, shape);
if (font != null) {
store.setRectangleFontSize(font, nextROI, shape);
}
Length l = new Length((double) lineWidth, UNITS.PIXEL);
store.setRectangleStrokeWidth(l, nextROI, shape);
double centerX = realX + (width / 2);
double centerY = realY + (height / 2);
store.setRectangleTransform(getRotationTransform(angle), nextROI, shape);
if (row < divide - 1 || col < divide - 1)
shape++;
}
}
} else if (shapeType == LINE) {
store.setLineID(shapeID, nextROI, shape);
store.setLineX1((double) x, nextROI, shape);
store.setLineY1((double) y, nextROI, shape);
store.setLineX2((double) (x + width), nextROI, shape);
store.setLineY2((double) (y + height), nextROI, shape);
store.setLineTheZ(new NonNegativeInteger(zIndex), nextROI, shape);
store.setLineTheT(new NonNegativeInteger(tIndex), nextROI, shape);
if (font != null) {
store.setLineFontSize(font, nextROI, shape);
}
Length l = new Length((double) lineWidth, UNITS.PIXEL);
store.setLineStrokeWidth(l, nextROI, shape);
int centerX = x + (width / 2);
int centerY = y + (height / 2);
store.setLineTransform(getRotationTransform(angle), nextROI, shape);
} else if (shapeType == CIRCLE || shapeType == ELLIPSE) {
double rx = width / 2;
double ry = shapeType == CIRCLE ? rx : height / 2;
store.setEllipseID(shapeID, nextROI, shape);
store.setEllipseX(x + rx, nextROI, shape);
store.setEllipseY(y + ry, nextROI, shape);
store.setEllipseRadiusX(rx, nextROI, shape);
store.setEllipseRadiusY(ry, nextROI, shape);
store.setEllipseTheZ(new NonNegativeInteger(zIndex), nextROI, shape);
store.setEllipseTheT(new NonNegativeInteger(tIndex), nextROI, shape);
if (font != null) {
store.setEllipseFontSize(font, nextROI, shape);
}
Length l = new Length((double) lineWidth, UNITS.PIXEL);
store.setEllipseStrokeWidth(l, nextROI, shape);
store.setEllipseTransform(getRotationTransform(angle), nextROI, shape);
} else if (shapeType == POLYGON || shapeType == FREE_SHAPE || shapeType == POLYLINE || shapeType == FREE_LINE) {
final StringBuilder points = new StringBuilder();
for (int point = 0; point < xc.length; point++) {
points.append(xc[point]);
points.append(",");
points.append(yc[point]);
if (point < xc.length - 1)
points.append(" ");
}
if (shapeType == POLYLINE || shapeType == FREE_LINE) {
store.setPolylineID(shapeID, nextROI, shape);
store.setPolylinePoints(points.toString(), nextROI, shape);
store.setPolylineTransform(getRotationTransform(angle), nextROI, shape);
store.setPolylineTheZ(new NonNegativeInteger(zIndex), nextROI, shape);
store.setPolylineTheT(new NonNegativeInteger(tIndex), nextROI, shape);
if (font != null) {
store.setPolylineFontSize(font, nextROI, shape);
}
Length l = new Length((double) lineWidth, UNITS.PIXEL);
store.setPolylineStrokeWidth(l, nextROI, shape);
} else {
store.setPolygonID(shapeID, nextROI, shape);
store.setPolygonPoints(points.toString(), nextROI, shape);
store.setPolygonTransform(getRotationTransform(angle), nextROI, shape);
store.setPolygonTheZ(new NonNegativeInteger(zIndex), nextROI, shape);
store.setPolygonTheT(new NonNegativeInteger(tIndex), nextROI, shape);
if (font != null) {
store.setPolygonFontSize(font, nextROI, shape);
}
Length l = new Length((double) lineWidth, UNITS.PIXEL);
store.setPolygonStrokeWidth(l, nextROI, shape);
}
} else {
if (shape == 0)
nextROI--;
shape--;
}
}
}
}
return nextROI;
}
use of ome.units.quantity.Length in project bioformats by openmicroscopy.
the class Ecat7Reader 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);
CoreMetadata ms0 = core.get(0);
String check = in.readString(14).trim();
if (!check.matches(ECAT7_MAGIC_REGEX)) {
throw new FormatException("Invalid ECAT 7 file.");
}
String originalPath = in.readString(32);
short version = in.readShort();
short systemType = in.readShort();
short fileType = in.readShort();
String serialNumber = in.readString(10);
int scanStart = in.readInt();
String isotopeName = in.readString(8);
float isotopeHalflife = in.readFloat();
String radioPharmaceutical = in.readString(32);
float gantryTilt = in.readFloat();
float gantryRotation = in.readFloat();
float bedElevation = in.readFloat();
float intrinsicTilt = in.readFloat();
short wobbleSpeed = in.readShort();
short sourceType = in.readShort();
float distanceScanned = in.readFloat();
float transaxialFOV = in.readFloat();
short angularCompression = in.readShort();
short coinSampleMode = in.readShort();
short axialSampleMode = in.readShort();
float calibrationFactor = in.readFloat();
short calibrationUnits = in.readShort();
short calibrationLabel = in.readShort();
short compression = in.readShort();
String studyType = in.readString(12);
String patientID = in.readString(16);
String patientName = in.readString(32);
String patientSex = in.readString(1);
String patientDexterity = in.readString(1);
float patientAge = in.readFloat();
float patientHeight = in.readFloat();
float patientWeight = in.readFloat();
int patientBirthDate = in.readInt();
String physicianName = in.readString(32);
String operatorName = in.readString(32);
String description = in.readString(32);
short acquisitionType = in.readShort();
short patientOrientation = in.readShort();
String facilityName = in.readString(20);
ms0.sizeZ = in.readShort();
ms0.sizeT = in.readShort();
short numGates = in.readShort();
short numBedPositions = in.readShort();
float initBedPosition = in.readFloat();
float[] bedPositions = new float[15];
for (int i = 0; i < bedPositions.length; i++) {
bedPositions[i] = in.readFloat();
}
float planeSeparation = in.readFloat();
short lowerThreshold = in.readShort();
short trueLowerThreshold = in.readShort();
short trueUpperThreshold = in.readShort();
String processCode = in.readString(10);
short acquisitionMode = in.readShort();
float binSize = in.readFloat();
float branchingFraction = in.readFloat();
int doseStartTime = in.readInt();
float dosage = in.readFloat();
float wellCounterCorrectionFactor = in.readFloat();
String dataUnits = in.readString(32);
short septaState = in.readShort();
short[] fillCTI = new short[6];
for (int i = 0; i < fillCTI.length; i++) {
fillCTI[i] = in.readShort();
}
in.skipBytes(512);
short dataType = in.readShort();
short numDimensions = in.readShort();
ms0.sizeX = in.readShort();
ms0.sizeY = in.readShort();
in.skipBytes(2);
float xOffset = in.readFloat();
float yOffset = in.readFloat();
float zOffset = in.readFloat();
float reconZoom = in.readFloat();
float scaleFactor = in.readFloat();
short imageMin = in.readShort();
short imageMax = in.readShort();
float xPixelSize = in.readFloat();
float yPixelSize = in.readFloat();
float zPixelSize = in.readFloat();
int frameDuration = in.readInt();
int frameStartTime = in.readInt();
short filterCode = in.readShort();
float xResolution = in.readFloat();
float yResolution = in.readFloat();
float zResolution = in.readFloat();
float numRElements = in.readFloat();
float numAngles = in.readFloat();
float zRotationAngle = in.readFloat();
float decayCorrectionFactor = in.readFloat();
int processingCode = in.readInt();
int gateDuration = in.readInt();
int rWaveOffset = in.readInt();
int numAcceptedBeats = in.readInt();
float filterCutoffFrequency = in.readFloat();
float filterResolution = in.readFloat();
float filterRampSlope = in.readFloat();
short filterOrder = in.readShort();
float filterScatterFraction = in.readFloat();
float filterScatterSlope = in.readFloat();
String annotation = in.readString(40);
float[][] matrix = new float[3][4];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length - 1; j++) {
matrix[i][j] = in.readFloat();
}
}
float rFilterCutoff = in.readFloat();
float rFilterResolution = in.readFloat();
short rFilterCode = in.readShort();
short rFilterOrder = in.readShort();
float zFilterCutoff = in.readFloat();
float zFilterResolution = in.readFloat();
short zFilterCode = in.readShort();
short zFilterOrder = in.readShort();
matrix[0][3] = in.readFloat();
matrix[1][3] = in.readFloat();
matrix[2][3] = in.readFloat();
short scatterType = in.readShort();
short reconType = in.readShort();
short reconViews = in.readShort();
short[] ctiFill = new short[87];
for (int i = 0; i < ctiFill.length; i++) {
ctiFill[i] = in.readShort();
}
short[] userFill = new short[48];
for (int i = 0; i < userFill.length; i++) {
userFill[i] = in.readShort();
}
ms0.sizeC = 1;
ms0.imageCount = getSizeZ() * getSizeT() * getSizeC();
ms0.dimensionOrder = "XYZTC";
switch(dataType) {
case 6:
ms0.pixelType = FormatTools.UINT16;
break;
default:
throw new FormatException("Unsupported data type: " + dataType);
}
addGlobalMeta("Original path", originalPath);
addGlobalMeta("Version", version);
addGlobalMeta("System type", systemType);
addGlobalMeta("File type", fileType);
addGlobalMeta("Serial number", serialNumber);
addGlobalMeta("Scan start", scanStart);
addGlobalMeta("Isotope Name", isotopeName);
addGlobalMeta("Isotope half-life", isotopeHalflife);
addGlobalMeta("Radiopharmaceutical", radioPharmaceutical);
addGlobalMeta("Gantry tilt", gantryTilt);
addGlobalMeta("Gantry rotation", gantryRotation);
addGlobalMeta("Bed elevation", bedElevation);
addGlobalMeta("Intrinsic tilt", intrinsicTilt);
addGlobalMeta("Wobble speed", wobbleSpeed);
addGlobalMeta("Source type", sourceType);
addGlobalMeta("Distance scanned", distanceScanned);
addGlobalMeta("Transaxial FOV", transaxialFOV);
addGlobalMeta("Angular compression", angularCompression);
addGlobalMeta("Coin. sample mode", coinSampleMode);
addGlobalMeta("Axial sample mode", axialSampleMode);
addGlobalMeta("Calibration factor", calibrationFactor);
addGlobalMeta("Calibration units", calibrationUnits);
addGlobalMeta("Calibration units label", calibrationLabel);
addGlobalMeta("Compression", compression);
addGlobalMeta("Study type", studyType);
addGlobalMeta("Patient ID", patientID);
addGlobalMeta("Patient name", patientName);
addGlobalMeta("Patient sex", patientSex);
addGlobalMeta("Patient dexterity", patientDexterity);
addGlobalMeta("Patient age", patientAge);
addGlobalMeta("Patient height", patientHeight);
addGlobalMeta("Patient weight", patientWeight);
addGlobalMeta("Patient birth date", patientBirthDate);
addGlobalMeta("Physician name", physicianName);
addGlobalMeta("Operator name", operatorName);
addGlobalMeta("Description", description);
addGlobalMeta("Acquisition type", acquisitionType);
addGlobalMeta("Patient orientation", patientOrientation);
addGlobalMeta("Facility name", facilityName);
addGlobalMeta("Number of gates", numGates);
addGlobalMeta("Number of bed positions", numBedPositions);
for (float bedPos : bedPositions) {
addGlobalMetaList("Bed position", bedPos);
}
addGlobalMeta("Plane separation", planeSeparation);
addGlobalMeta("Lower threshold", lowerThreshold);
addGlobalMeta("True lower threshold", trueLowerThreshold);
addGlobalMeta("True upper threshold", trueUpperThreshold);
addGlobalMeta("Process code", processCode);
addGlobalMeta("Acquistion mode", acquisitionMode);
addGlobalMeta("Bin size", binSize);
addGlobalMeta("Branching fraction", branchingFraction);
addGlobalMeta("Dose start time", doseStartTime);
addGlobalMeta("Dosage", dosage);
addGlobalMeta("Well counter correction factor", wellCounterCorrectionFactor);
addGlobalMeta("Data units", dataUnits);
addGlobalMeta("Septa state", septaState);
for (float fill : fillCTI) {
addGlobalMetaList("Fill CTI", fill);
}
addGlobalMeta("Data type", dataType);
addGlobalMeta("Number of dimensions", numDimensions);
addGlobalMeta("X offset", xOffset);
addGlobalMeta("Y offset", yOffset);
addGlobalMeta("Z offset", zOffset);
addGlobalMeta("Recon. zoom", reconZoom);
addGlobalMeta("Scale factor", scaleFactor);
addGlobalMeta("Image minimum", imageMin);
addGlobalMeta("Image maximum", imageMax);
addGlobalMeta("X pixel size", xPixelSize);
addGlobalMeta("Y pixel size", yPixelSize);
addGlobalMeta("Z pixel size", zPixelSize);
addGlobalMeta("Frame duration", frameDuration);
addGlobalMeta("Frame start time", frameStartTime);
addGlobalMeta("Filter code", filterCode);
addGlobalMeta("X resolution", xResolution);
addGlobalMeta("Y resolution", yResolution);
addGlobalMeta("Z resolution", zResolution);
addGlobalMeta("Number of R elements", numRElements);
addGlobalMeta("Number of angles", numAngles);
addGlobalMeta("Z rotation angle", zRotationAngle);
addGlobalMeta("Decay correction factor", decayCorrectionFactor);
addGlobalMeta("Processing code", processingCode);
addGlobalMeta("Gate duration", gateDuration);
addGlobalMeta("R wave offset", rWaveOffset);
addGlobalMeta("Number of accepted beats", numAcceptedBeats);
addGlobalMeta("Filter cutoff frequency", filterCutoffFrequency);
addGlobalMeta("Filter resolution", filterResolution);
addGlobalMeta("Filter ramp slope", filterRampSlope);
addGlobalMeta("Filter order", filterOrder);
addGlobalMeta("Filter scatter fraction", filterScatterFraction);
addGlobalMeta("Filter scatter slope", filterScatterSlope);
addGlobalMeta("Annotation", annotation);
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
addGlobalMeta("MT (" + (i + 1) + ", " + (j + 1) + ")", matrix[i][j]);
}
}
addGlobalMeta("R filter cutoff", rFilterCutoff);
addGlobalMeta("R filter resolution", rFilterResolution);
addGlobalMeta("R filter code", rFilterCode);
addGlobalMeta("R filter order", rFilterOrder);
addGlobalMeta("Z filter cutoff", zFilterCutoff);
addGlobalMeta("Z filter resolution", zFilterResolution);
addGlobalMeta("Z filter code", zFilterCode);
addGlobalMeta("Z filter order", zFilterOrder);
addGlobalMeta("Scatter type", scatterType);
addGlobalMeta("Recon. type", reconType);
addGlobalMeta("Recon. views", reconViews);
for (float cti : ctiFill) {
addGlobalMeta("CTI fill", cti);
}
for (float user : userFill) {
addGlobalMeta("User fill", user);
}
MetadataStore store = makeFilterMetadata();
MetadataTools.populatePixels(store, this);
if (getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
store.setImageDescription(description, 0);
Length sizeX = FormatTools.getPhysicalSizeX(new Double(xPixelSize));
Length sizeY = FormatTools.getPhysicalSizeY(new Double(yPixelSize));
Length sizeZ = FormatTools.getPhysicalSizeZ(new Double(zPixelSize));
if (sizeX != null) {
store.setPixelsPhysicalSizeX(sizeX, 0);
}
if (sizeY != null) {
store.setPixelsPhysicalSizeY(sizeY, 0);
}
if (sizeZ != null) {
store.setPixelsPhysicalSizeZ(sizeZ, 0);
}
}
}
Aggregations