Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
4277:c5ca798b158a | 4278:9279de56a405 |
---|---|
102 return; | 102 return; |
103 } | 103 } |
104 | 104 |
105 min = std::numeric_limits<int32_t>::max(); | 105 min = std::numeric_limits<int32_t>::max(); |
106 max = std::numeric_limits<int32_t>::min(); | 106 max = std::numeric_limits<int32_t>::min(); |
107 | |
108 const unsigned int height = information_.GetHeight(); | |
109 const unsigned int width = information_.GetWidth(); | |
110 const unsigned int channels = information_.GetChannelCount(); | |
107 | 111 |
108 for (unsigned int y = 0; y < information_.GetHeight(); y++) | 112 for (unsigned int y = 0; y < height; y++) |
109 { | 113 { |
110 for (unsigned int x = 0; x < information_.GetWidth(); x++) | 114 for (unsigned int x = 0; x < width; x++) |
111 { | 115 { |
112 for (unsigned int c = 0; c < information_.GetChannelCount(); c++) | 116 for (unsigned int c = 0; c < channels; c++) |
113 { | 117 { |
114 int32_t v = GetValue(x, y); | 118 int32_t v = GetValue(x, y); |
115 if (v < min) | 119 if (v < min) |
116 min = v; | 120 min = v; |
117 if (v > max) | 121 if (v > max) |