public class IntegerScalingOfFloatingPointPixelData
extends java.lang.Object
A class of static methods to interconvert floating point pixel data to scaled integer values.
Constructor and Description |
---|
IntegerScalingOfFloatingPointPixelData() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] arg)
Read a DICOM image input format file and convert floating point pixel data to scaled or truncated integer values or vice versa.
|
static void |
performIntegerScaling(java.lang.String inputFileName,
java.lang.String outputFileName,
boolean truncate)
Read a DICOM image with grayscale floating point PixelData and either scales it to integer values sufficient to represent the dynamic range or trunctates the floating point values to unsigned short integers.
|
static void |
reportOnRoundTrip(double input,
double slope,
double intercept,
java.lang.String message) |
static void |
reverseIntegerScaling(java.lang.String inputFileName,
java.lang.String outputFileName,
boolean toDouble)
Read a DICOM image with grayscale integer PixelData and scale it to single or double length floating point values based on the Rescale Slope and Intercept.
|
public IntegerScalingOfFloatingPointPixelData()
public static void main(java.lang.String[] arg)
Read a DICOM image input format file and convert floating point pixel data to scaled or truncated integer values or vice versa.
arg
- two or three parameters, an optional direction argument (toFloat|toInt|toIntTruncate, case insensitive, defaults to toInt), the inputFile, and the outputFilepublic static void performIntegerScaling(java.lang.String inputFileName, java.lang.String outputFileName, boolean truncate) throws DicomException, java.io.FileNotFoundException, java.io.IOException
Read a DICOM image with grayscale floating point PixelData and either scales it to integer values sufficient to represent the dynamic range or trunctates the floating point values to unsigned short integers.
The dynamic range of the input is mapped to the full range of the short unsigned integer output pixel values (0 to 65535)
The scaling values are recorded in Rescale Slope and Intercept.
inputFileName
- the input file nameoutputFileName
- the output file nametruncate
- truncate the floating point pixel values rather than scaling them to the maximum dynamic rangeDicomException
java.io.FileNotFoundException
java.io.IOException
public static void reportOnRoundTrip(double input, double slope, double intercept, java.lang.String message)
public static void reverseIntegerScaling(java.lang.String inputFileName, java.lang.String outputFileName, boolean toDouble) throws DicomException, java.io.FileNotFoundException, java.io.IOException
Read a DICOM image with grayscale integer PixelData and scale it to single or double length floating point values based on the Rescale Slope and Intercept.
inputFileName
- the input file nameoutputFileName
- the output file nametoDouble
- if true make double else float pixel valuesDicomException
java.io.FileNotFoundException
java.io.IOException