DCMTK
Version 3.6.6
OFFIS DICOM Toolkit
|
A helper class for comparing an original image with a processed version (e.g. More...
Public Member Functions | |
DicomImageComparison () | |
default constructor | |
virtual | ~DicomImageComparison () |
destructor | |
OFCondition | initializeDiffImage (OFCmdFloat amplify=1.0) |
instruct the DicomImageComparison instance that the creation of a difference image during image comparison is requested. More... | |
OFCondition | saveDiffImage (const char *ofname) |
save the difference image created during image comparison. More... | |
OFCondition | readReferenceImage (const char *ifname, E_TransferSyntax xfer, E_FileReadMode readMode, unsigned long compatibilityMode) |
read reference image for image comparison from file More... | |
OFCondition | readTestImage (const char *ifname, E_TransferSyntax xfer, E_FileReadMode readMode, unsigned long compatibilityMode) |
read test image for image comparison from file More... | |
OFCondition | configureImages (EW_WindowType windowType, OFBool sharedWindow, OFCmdUnsignedInt windowParameter, OFCmdFloat windowCenter, OFCmdFloat windowWidth, EF_VoiLutFunction voiFunction, ES_PresentationLut presShape) |
configure the display pipelines for both referenced and test image. More... | |
OFCondition | computeImageComparisonMetrics (EW_WindowType windowType) |
compare both images and compute image comparion metrics. More... | |
unsigned long | getMaxAbsoluteError () const |
return maximum absolute error | |
double | getMeanAbsoluteError () const |
return mean absolute error | |
double | getRootMeanSquareError () const |
return root mean square error | |
double | getPeakSignalToNoiseRatio () const |
return peak signal to noise ratio | |
double | getSignalToNoiseRatio () const |
return signal to noise ratio | |
Private Member Functions | |
DicomImageComparison (const DicomImageComparison &rhs) | |
private undefined copy constructor | |
DicomImageComparison & | operator= (const DicomImageComparison &arg) |
private undefined copy assignment operator | |
OFCondition | checkImageCharacteristics () const |
check if reference and test image have the same resolution, number of frames and color model (color or monochrome). More... | |
OFCondition | computeMonochromeImageComparionMetricsWord () |
compare two images that are both monochrome and have more than 8 bits/pixel in internal storage, as determined by BitsStored and the Modality LUT that may have been applied. More... | |
OFCondition | computeMonochromeImageComparionMetricsRaw () |
compare two monochrome images without setting a VOI window. More... | |
OFCondition | computeMonochromeImageComparionMetricsByte () |
compare two images that are both monochrome and have at most 8 bits/pixel in internal storage, as determined by BitsStored and the Modality LUT that may have been applied. More... | |
OFCondition | computeColorImageComparionMetrics () |
compare two images that are both color images. More... | |
Static Private Member Functions | |
static OFCondition | readDICOMImage (DicomImage *&di, OFBool isReference, const char *ifname, E_TransferSyntax xfer, E_FileReadMode readMode, unsigned long compatibilityMode, DcmItem *diffImage) |
read DICOM image and store pointer to it More... | |
static OFCondition | configureImage (DicomImage *di, EW_WindowType windowType, OFCmdUnsignedInt windowParameter, OFCmdFloat &windowCenter, OFCmdFloat &windowWidth, EF_VoiLutFunction voiFunction, ES_PresentationLut presShape, int &depth) |
configure the display pipeline for a given DICOM image. More... | |
static OFCondition | copyReferenceImageAttributes (DcmItem *src, DcmItem *diffImage) |
initialize the difference image DICOM dataset by copying all required attributes from the reference image and by generating all other attributes except for the image pixel module, SOP Class UID, and the information to be copied from the test image. More... | |
static OFCondition | copyTestImageAttributes (DcmItem *src, DcmItem *diffImage) |
further populate the difference image DICOM dataset by copying all required attributes from the test image. More... | |
static void | logImageInfo (DicomImage *di, const char *filename) |
print the characteristics of the image to to logger at DEBUG level. More... | |
static void | createFrameLabelVector (OFString &s, unsigned long numFrames, OFBool isColor) |
create content for frame label vector More... | |
Private Attributes | |
DicomImage * | di_reference |
pointer to reference image | |
DicomImage * | di_test |
pointer to test image | |
DcmFileFormat * | diff_image |
difference image in DICOM format | |
unsigned long | max_error |
result of image comparison: max difference between a sample value in the reference image and the corresponding sample value in the test image | |
int | reference_bits |
bits/sample to use when processing the reference image | |
int | test_bits |
bits/sample to use when processing the test image | |
double | meanAbsoluteError |
result of image comparison: mean absolute error | |
double | rootMeanSquareError |
result of image comparison: root mean square error (RMSE) | |
double | peakSignalToNoiseRatio |
result of image comparison: peak signal to noise ratio (PSNR) | |
double | signalToNoiseRatio |
result of image comparison: signal to noise ratio (SNR) | |
double | amplification |
factor by which all pixel values of the difference image will be multiplied | |
A helper class for comparing an original image with a processed version (e.g.
after lossy compression).
|
private |
check if reference and test image have the same resolution, number of frames and color model (color or monochrome).
|
private |
compare two images that are both color images.
OFCondition DicomImageComparison::computeImageComparisonMetrics | ( | EW_WindowType | windowType | ) |
compare both images and compute image comparion metrics.
windowType | VOI LUT transformation to apply |
|
private |
compare two images that are both monochrome and have at most 8 bits/pixel in internal storage, as determined by BitsStored and the Modality LUT that may have been applied.
|
private |
compare two monochrome images without setting a VOI window.
|
private |
compare two images that are both monochrome and have more than 8 bits/pixel in internal storage, as determined by BitsStored and the Modality LUT that may have been applied.
|
staticprivate |
configure the display pipeline for a given DICOM image.
di | DICOM image, must not be NULL |
windowType | VOI LUT transformation to apply |
windowParameter | index of VOI LUT/window in file (if windowType is EWT_window_from_file or EWT_voi_lut_from_file) |
windowCenter | window center (input for EWT_window_parameters, output for EWT_window_min_max and EWT_window_min_max_n) |
windowWidth | window width (input for EWT_window_parameters, output for EWT_window_min_max and EWT_window_min_max_n) |
voiFunction | VOI LUT function (linear or sigmoid) |
presShape | Presentation LUT Shape (identity, reverse, lin OD) |
depth | bit depth to be used when accessing pixel data for this image returned in this parameter |
OFCondition DicomImageComparison::configureImages | ( | EW_WindowType | windowType, |
OFBool | sharedWindow, | ||
OFCmdUnsignedInt | windowParameter, | ||
OFCmdFloat | windowCenter, | ||
OFCmdFloat | windowWidth, | ||
EF_VoiLutFunction | voiFunction, | ||
ES_PresentationLut | presShape | ||
) |
configure the display pipelines for both referenced and test image.
windowType | VOI LUT transformation to apply |
sharedWindow | compute common min/max window for both images if true, separate windows if false |
windowParameter | index of VOI LUT/window in file (if windowType is EWT_window_from_file or EWT_voi_lut_from_file) |
windowCenter | window center (ignored unless windowType is EWT_window_parameters) |
windowWidth | window width (ignored unless windowType is EWT_window_parameters) |
voiFunction | VOI LUT function (linear or sigmoid) |
presShape | Presentation LUT Shape (identity, reverse, lin OD) |
|
staticprivate |
initialize the difference image DICOM dataset by copying all required attributes from the reference image and by generating all other attributes except for the image pixel module, SOP Class UID, and the information to be copied from the test image.
src | reference image main dataset |
diffImage | difference image main dataset |
|
staticprivate |
further populate the difference image DICOM dataset by copying all required attributes from the test image.
src | reference image main dataset |
diffImage | difference image main dataset |
|
staticprivate |
create content for frame label vector
s | string to which the frame label vector is written |
numFrames | number of frames present in the reference image |
isColor | true if reference image is a color image |
OFCondition DicomImageComparison::initializeDiffImage | ( | OFCmdFloat | amplify = 1.0 | ) |
instruct the DicomImageComparison instance that the creation of a difference image during image comparison is requested.
This function must be called prior to the call to readReferenceImage().
amplify | factor by which all pixel values in the difference image will be multiplied |
|
staticprivate |
print the characteristics of the image to to logger at DEBUG level.
di | DICOM image |
filename | filename from which the image was loaded |
|
staticprivate |
read DICOM image and store pointer to it
di | pointer to DICOM image, not NULL upon success, NULL otherwise |
isReference | indicates whether we're reading the reference image or the test image |
ifname | filename for DcmFileFormat::loadFile() |
xfer | DICOM transfer syntax for DcmFileFormat::loadFile() |
readMode | file read mode for DcmFileFormat::loadFile() |
compatibilityMode | compatibility mode for DicomImage constructor |
diffImage | pointer to DICOM dataset for difference image, may be NULL |
OFCondition DicomImageComparison::readReferenceImage | ( | const char * | ifname, |
E_TransferSyntax | xfer, | ||
E_FileReadMode | readMode, | ||
unsigned long | compatibilityMode | ||
) |
read reference image for image comparison from file
ifname | filename for DcmFileFormat::loadFile() |
xfer | DICOM transfer syntax for DcmFileFormat::loadFile() |
readMode | file read mode for DcmFileFormat::loadFile() |
compatibilityMode | compatibility mode for DicomImage constructor |
OFCondition DicomImageComparison::readTestImage | ( | const char * | ifname, |
E_TransferSyntax | xfer, | ||
E_FileReadMode | readMode, | ||
unsigned long | compatibilityMode | ||
) |
read test image for image comparison from file
ifname | filename for DcmFileFormat::loadFile() |
xfer | DICOM transfer syntax for DcmFileFormat::loadFile() |
readMode | file read mode for DcmFileFormat::loadFile() |
compatibilityMode | compatibility mode for DicomImage constructor |
OFCondition DicomImageComparison::saveDiffImage | ( | const char * | ofname | ) |
save the difference image created during image comparison.
This function must be called after to the call to computeImageComparisonMetrics().
ofname | filename to be created |