Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions components/formats-gpl/src/loci/formats/in/CellSensReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Hashtable;

import loci.common.ByteArrayHandle;
import loci.common.Constants;
import loci.common.DataTools;
import loci.common.DateTools;
import loci.common.Location;
Expand Down Expand Up @@ -1862,6 +1863,37 @@ else if (tag == RWC_FRAME_ORIGIN) {
pyramid.originY = doubleValues[1];
}
}
else if (tag == VALUE
&& "Calibration Function ".equals(tagPrefix)
&& realType == DOUBLE_2
&& nDoubleValues >= 4
&& (nDoubleValues % 2) == 0)
{
// Tag 20051 (CALIBRATION) sub-volumes carry a piecewise-
// linear lookup table mapping a raw axis (e.g. uint16
// pixel value) to a calibrated axis (e.g. Z position in
// micrometres for DSX EFI height maps, or intensity in
// counts for deconvolved fluorescence images). The LUT
// is stored as (raw, calibrated) DOUBLE_2 pairs and is
// linear, so a single (slope, origin) suffices to
// reconstruct the mapping. Surface those summary values
// as named metadata so downstream tools can convert
// pixel values to calibrated units without reparsing
// the full table from a long string.
int nPairs = nDoubleValues / 2;
double rawFirst = doubleValues[0];
double calFirst = doubleValues[1];
double rawLast = doubleValues[2 * (nPairs - 1)];
double calLast = doubleValues[2 * (nPairs - 1) + 1];
double dRaw = rawLast - rawFirst;
if (Math.abs(dRaw) > Constants.EPSILON) {
double slope = (calLast - calFirst) / dRaw;
addGlobalMeta("Calibration Function Slope", slope);
addGlobalMeta("Calibration Function Origin", calFirst);
addGlobalMeta("Calibration Function Final", calLast);
addGlobalMeta("Calibration Function NPoints", nPairs);
}
}
break;
case RGB:
int red = vsi.read();
Expand Down
Loading