comparison Framework/DicomizerParameters.cpp @ 217:20bc074ec19a

Viewer can display DICOM pyramids whose tile sizes vary across levels
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 12 Jan 2021 14:24:18 +0100
parents 1e864138f0da
children 49f647ed1b4c
comparison
equal deleted inserted replaced
216:c35a3a0627b9 217:20bc074ec19a
20 20
21 21
22 #include "PrecompiledHeadersWSI.h" 22 #include "PrecompiledHeadersWSI.h"
23 #include "DicomizerParameters.h" 23 #include "DicomizerParameters.h"
24 24
25 #include "ImageToolbox.h"
25 #include "Targets/FolderTarget.h" 26 #include "Targets/FolderTarget.h"
26 #include "Targets/OrthancTarget.h" 27 #include "Targets/OrthancTarget.h"
27 28
28 #include <OrthancException.h> 29 #include <OrthancException.h>
29 30
109 return defaultWidth; 110 return defaultWidth;
110 } 111 }
111 } 112 }
112 113
113 114
115 unsigned int DicomizerParameters::GetTargetTileWidth(const ITiledPyramid& source) const
116 {
117 ImageToolbox::CheckConstantTileSize(source);
118 return GetTargetTileWidth(source.GetTileWidth(0));
119 }
120
121
114 unsigned int DicomizerParameters::GetTargetTileHeight(unsigned int defaultHeight) const 122 unsigned int DicomizerParameters::GetTargetTileHeight(unsigned int defaultHeight) const
115 { 123 {
116 if (hasTargetTileSize_ && 124 if (hasTargetTileSize_ &&
117 targetTileHeight_ != 0) 125 targetTileHeight_ != 0)
118 { 126 {
123 return defaultHeight; 131 return defaultHeight;
124 } 132 }
125 } 133 }
126 134
127 135
136 unsigned int DicomizerParameters::GetTargetTileHeight(const ITiledPyramid& source) const
137 {
138 ImageToolbox::CheckConstantTileSize(source);
139 return GetTargetTileHeight(source.GetTileHeight(0));
140 }
141
142
128 void DicomizerParameters::SetThreadsCount(unsigned int threads) 143 void DicomizerParameters::SetThreadsCount(unsigned int threads)
129 { 144 {
130 if (threads == 0) 145 if (threads == 0)
131 { 146 {
132 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 147 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
158 { 173 {
159 if (pyramidLevelsCount_ != 0) 174 if (pyramidLevelsCount_ != 0)
160 { 175 {
161 return pyramidLevelsCount_; 176 return pyramidLevelsCount_;
162 } 177 }
178
179 ImageToolbox::CheckConstantTileSize(source);
163 180
164 // By default, the number of levels for the pyramid is taken so that 181 // By default, the number of levels for the pyramid is taken so that
165 // the upper level is reduced either to 1 column of tiles, or to 1 182 // the upper level is reduced either to 1 column of tiles, or to 1
166 // row of tiles. 183 // row of tiles.
167 unsigned int totalWidth = source.GetLevelWidth(0); 184 unsigned int totalWidth = source.GetLevelWidth(0);
203 { 220 {
204 return pyramidLowerLevelsCount_; 221 return pyramidLowerLevelsCount_;
205 } 222 }
206 223
207 unsigned int fullNumberOfTiles = ( 224 unsigned int fullNumberOfTiles = (
208 CeilingDivision(source.GetLevelWidth(0), source.GetTileWidth()) * 225 CeilingDivision(source.GetLevelWidth(0), source.GetTileWidth(0)) *
209 CeilingDivision(source.GetLevelHeight(0), source.GetTileHeight())); 226 CeilingDivision(source.GetLevelHeight(0), source.GetTileHeight(0)));
210 227
211 // By default, the number of lower levels in the pyramid is chosen 228 // By default, the number of lower levels in the pyramid is chosen
212 // as a compromise between the number of tasks (there should not be 229 // as a compromise between the number of tasks (there should not be
213 // too few tasks, otherwise multithreading would not be efficient) 230 // too few tasks, otherwise multithreading would not be efficient)
214 // and memory consumption (maximum 64MB of RAM due to the decoding 231 // and memory consumption (maximum 64MB of RAM due to the decoding