comparison Framework/ImageToolbox.cpp @ 167:605247fc8758

Fix issue #144 (OrthancWSIDicomizer PhotometricInterpretation)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jul 2019 12:00:31 +0200
parents 6b8ccfc02051
children cea9a4701fce
comparison
equal deleted inserted replaced
166:f0dac1e8f736 167:605247fc8758
156 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 156 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
157 } 157 }
158 } 158 }
159 159
160 160
161 Orthanc::ImageAccessor* DecodeRawTile(const std::string& source,
162 Orthanc::PixelFormat format,
163 unsigned int width,
164 unsigned int height)
165 {
166 unsigned int bpp = GetBytesPerPixel(format);
167
168 if (bpp * width * height != source.size())
169 {
170 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageSize);
171 }
172
173 Orthanc::ImageAccessor accessor;
174 accessor.AssignReadOnly(format, width, height, bpp * width, source.empty() ? NULL : source.c_str());
175
176 return Orthanc::Image::Clone(accessor);
177 }
178
179
161 void EncodeTile(std::string& target, 180 void EncodeTile(std::string& target,
162 const Orthanc::ImageAccessor& source, 181 const Orthanc::ImageAccessor& source,
163 ImageCompression compression, 182 ImageCompression compression,
164 uint8_t quality) 183 uint8_t quality)
165 { 184 {