Mercurial > hg > orthanc
diff OrthancFramework/Sources/DicomFormat/DicomIntegerPixelAccessor.cpp @ 4278:9279de56a405
avoid multiple calls to GetWidth() and GetHeight() on pixel loops
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 03 Nov 2020 20:05:55 +0100 |
parents | bf7b9edf6b81 |
children | d9473bd5ed43 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomIntegerPixelAccessor.cpp Tue Nov 03 18:45:32 2020 +0100 +++ b/OrthancFramework/Sources/DicomFormat/DicomIntegerPixelAccessor.cpp Tue Nov 03 20:05:55 2020 +0100 @@ -104,12 +104,16 @@ min = std::numeric_limits<int32_t>::max(); max = std::numeric_limits<int32_t>::min(); + + const unsigned int height = information_.GetHeight(); + const unsigned int width = information_.GetWidth(); + const unsigned int channels = information_.GetChannelCount(); - for (unsigned int y = 0; y < information_.GetHeight(); y++) + for (unsigned int y = 0; y < height; y++) { - for (unsigned int x = 0; x < information_.GetWidth(); x++) + for (unsigned int x = 0; x < width; x++) { - for (unsigned int c = 0; c < information_.GetChannelCount(); c++) + for (unsigned int c = 0; c < channels; c++) { int32_t v = GetValue(x, y); if (v < min)