comparison Framework/Loaders/OrthancMultiframeVolumeLoader.cpp @ 1117:383aa2a7d426 broker

integration mainline->broker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 Nov 2019 15:54:57 +0100
parents f72d1ab42932 33b0a762e98a
children 8e3763d1736a
comparison
equal deleted inserted replaced
1116:a08699daf78b 1117:383aa2a7d426
183 throw Orthanc::OrthancException( 183 throw Orthanc::OrthancException(
184 Orthanc::ErrorCode_NotImplemented, 184 Orthanc::ErrorCode_NotImplemented,
185 "No support for multiframe instances with transfer syntax: " + transferSyntaxUid_); 185 "No support for multiframe instances with transfer syntax: " + transferSyntaxUid_);
186 } 186 }
187 } 187 }
188
189 188
190 void OrthancMultiframeVolumeLoader::SetTransferSyntax(const std::string& transferSyntax) 189 void OrthancMultiframeVolumeLoader::SetTransferSyntax(const std::string& transferSyntax)
191 { 190 {
192 transferSyntaxUid_ = Orthanc::Toolbox::StripSpaces(transferSyntax); 191 transferSyntaxUid_ = Orthanc::Toolbox::StripSpaces(transferSyntax);
193 ScheduleFrameDownloads(); 192 ScheduleFrameDownloads();
252 { 251 {
253 // TODO - check alignement? 252 // TODO - check alignement?
254 target = le16toh(*reinterpret_cast<const uint16_t*>(source)); 253 target = le16toh(*reinterpret_cast<const uint16_t*>(source));
255 } 254 }
256 255
256 ORTHANC_FORCE_INLINE
257 static void CopyPixel(int16_t& target, const void* source)
258 {
259 // byte swapping is the same for unsigned and signed integers
260 // (the sign bit is always stored with the MSByte)
261 uint16_t* targetUp = reinterpret_cast<uint16_t*>(&target);
262 CopyPixel(*targetUp, source);
263 }
264
257 template <typename T> 265 template <typename T>
258 void OrthancMultiframeVolumeLoader::CopyPixelData(const std::string& pixelData) 266 void OrthancMultiframeVolumeLoader::CopyPixelData(const std::string& pixelData)
259 { 267 {
260 ImageBuffer3D& target = volume_->GetPixelData(); 268 ImageBuffer3D& target = volume_->GetPixelData();
261 269
291 T* target = reinterpret_cast<T*>(writer.GetAccessor().GetRow(y)); 299 T* target = reinterpret_cast<T*>(writer.GetAccessor().GetRow(y));
292 300
293 for (unsigned int x = 0; x < width; x++) 301 for (unsigned int x = 0; x < width; x++)
294 { 302 {
295 CopyPixel(*target, source); 303 CopyPixel(*target, source);
296
297 target ++; 304 target ++;
298 source += bpp; 305 source += bpp;
299 } 306 }
300 } 307 }
301 } 308 }
309 CopyPixelData<uint32_t>(pixelData); 316 CopyPixelData<uint32_t>(pixelData);
310 break; 317 break;
311 case Orthanc::PixelFormat_Grayscale16: 318 case Orthanc::PixelFormat_Grayscale16:
312 CopyPixelData<uint16_t>(pixelData); 319 CopyPixelData<uint16_t>(pixelData);
313 break; 320 break;
321 case Orthanc::PixelFormat_SignedGrayscale16:
322 CopyPixelData<int16_t>(pixelData);
323 break;
314 default: 324 default:
315 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); 325 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
316 } 326 }
317 327
318 volume_->IncrementRevision(); 328 volume_->IncrementRevision();