diff Framework/Volumes/ImageBuffer3D.cpp @ 949:32eaf4929b08 toa2019081301

OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 13 Aug 2019 16:01:05 +0200
parents c3bbb130abc4
children 640feb146fa8
line wrap: on
line diff
--- a/Framework/Volumes/ImageBuffer3D.cpp	Sat Aug 10 13:13:11 2019 +0200
+++ b/Framework/Volumes/ImageBuffer3D.cpp	Tue Aug 13 16:01:05 2019 +0200
@@ -75,12 +75,14 @@
 
   Orthanc::Image*  ImageBuffer3D::ExtractSagittalSlice(unsigned int slice) const
   {
+    //LOG(TRACE) << "ImageBuffer3D::ExtractSagittalSlice this= " << std::hex << this << std::dec << " width_ = " << width_ << " height_ = " << height_ << " depth_ = " << depth_ << " slice = " << slice;
     if (slice >= width_)
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
     }
 
     std::auto_ptr<Orthanc::Image> result(new Orthanc::Image(format_, height_, depth_, false));
+    //LOG(TRACE) << "ImageBuffer3D::ExtractSagittalSlice result will be an image of WIDTH = " << height_ << " and HEIGHT = " << depth_;
 
     unsigned int bytesPerPixel = Orthanc::GetBytesPerPixel(format_);
 
@@ -91,10 +93,10 @@
 
       for (unsigned int y = 0; y < height_; y++)
       {
-        const void* source = (reinterpret_cast<const uint8_t*>(image_.GetConstRow(y + z * height_)) +
-                              bytesPerPixel * slice);
-
-        memcpy(target, source, bytesPerPixel);
+        const void* source = (reinterpret_cast<const uint8_t*>(image_.GetConstRow(y + z * height_)) + bytesPerPixel * slice);
+        const uint8_t* byteSrc = reinterpret_cast<const uint8_t*>(source);
+        for (size_t byte = 0; byte < bytesPerPixel; ++byte)
+          target[byte] = byteSrc[byte];
         target += bytesPerPixel;
       }
     }