diff --git a/dcmimgle/include/dcmtk/dcmimgle/dimoipxt.h b/dcmimgle/include/dcmtk/dcmimgle/dimoipxt.h index e746a68b9..e749a6b16 100644 --- a/dcmimgle/include/dcmtk/dcmimgle/dimoipxt.h +++ b/dcmimgle/include/dcmtk/dcmimgle/dimoipxt.h @@ -1,6 +1,6 @@ /* * - * Copyright (C) 1996-2021, OFFIS e.V. + * Copyright (C) 1996-2025, OFFIS e.V. * All rights reserved. See COPYRIGHT file for details. * * This software and supporting documentation were developed by @@ -55,16 +55,16 @@ class DiMonoInputPixelTemplate DiMonoModality *modality) : DiMonoPixelTemplate(pixel, modality) { - if ((pixel != NULL) && (this->Count > 0)) + if ((pixel != NULL) && (this->Modality != NULL) && (this->Count > 0)) { // check whether to apply any modality transform - if ((this->Modality != NULL) && this->Modality->hasLookupTable() && (bitsof(T1) <= MAX_TABLE_ENTRY_SIZE)) + if (this->Modality->hasLookupTable() && (bitsof(T1) <= MAX_TABLE_ENTRY_SIZE)) { modlut(pixel); // ignore modality LUT min/max values since the image does not necessarily have to use all LUT entries this->determineMinMax(); } - else if ((this->Modality != NULL) && this->Modality->hasRescaling()) + else if (this->Modality->hasRescaling()) { rescale(pixel, this->Modality->getRescaleSlope(), this->Modality->getRescaleIntercept()); this->determineMinMax(OFstatic_cast(T3, this->Modality->getMinValue()), OFstatic_cast(T3, this->Modality->getMaxValue()));