Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp @ 2075:d84bdcbd8bf1
allow negative values in Grid Frame Offset Vector (3004, 000c)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Jul 2023 13:20:20 +0200 |
parents | f4050908c6bc |
children | 990f396484b1 |
comparison
equal
deleted
inserted
replaced
2074:e160c324c32a | 2075:d84bdcbd8bf1 |
---|---|
147 // - the offsets is positive (increasing throughout the frames) | 147 // - the offsets is positive (increasing throughout the frames) |
148 if (!sliceThicknessPresent) | 148 if (!sliceThicknessPresent) |
149 { | 149 { |
150 if (frameOffsets_.size() >= 2) | 150 if (frameOffsets_.size() >= 2) |
151 { | 151 { |
152 double sliceThickness = frameOffsets_[1] - frameOffsets_[0]; | 152 double sliceThickness = std::abs(frameOffsets_[1] - frameOffsets_[0]); |
153 | 153 |
154 if (sliceThickness > 0) | 154 if (sliceThickness > 0) |
155 { | 155 { |
156 bool sameSized = true; | 156 bool sameSized = true; |
157 | 157 |
158 for (size_t i = 2; i < frameOffsets_.size(); ++i) | 158 for (size_t i = 2; i < frameOffsets_.size(); ++i) |
159 { | 159 { |
160 double currentThickness = frameOffsets_[i] - frameOffsets_[i-1]; | 160 double currentThickness = std::abs(frameOffsets_[i] - frameOffsets_[i-1]); |
161 if (!LinearAlgebra::IsNear(sliceThickness, currentThickness)) | 161 if (!LinearAlgebra::IsNear(sliceThickness, currentThickness)) |
162 { | 162 { |
163 LOG(ERROR) << "Unable to extract slice thickness from GridFrameOffsetVector (3004,000C) (reason: varying spacing)"; | 163 LOG(ERROR) << "Unable to extract slice thickness from GridFrameOffsetVector (3004,000C) (reason: varying spacing)"; |
164 sameSized = false; | 164 sameSized = false; |
165 break; | 165 break; |
732 | 732 |
733 spacing = std::abs(data_.frameOffsets_[1] - data_.frameOffsets_[0]); | 733 spacing = std::abs(data_.frameOffsets_[1] - data_.frameOffsets_[0]); |
734 | 734 |
735 for (size_t i = 1; i + 1 < data_.frameOffsets_.size(); i++) | 735 for (size_t i = 1; i + 1 < data_.frameOffsets_.size(); i++) |
736 { | 736 { |
737 double s = data_.frameOffsets_[i + 1] - data_.frameOffsets_[i]; | 737 double s = std::abs(data_.frameOffsets_[i + 1] - data_.frameOffsets_[i]); |
738 if (!LinearAlgebra::IsNear(spacing, s, 0.001)) | 738 if (!LinearAlgebra::IsNear(spacing, s, 0.001)) |
739 { | 739 { |
740 return false; | 740 return false; |
741 } | 741 } |
742 } | 742 } |