Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
948:141cc19e6b7d | 949:32eaf4929b08 |
---|---|
73 } | 73 } |
74 | 74 |
75 | 75 |
76 Orthanc::Image* ImageBuffer3D::ExtractSagittalSlice(unsigned int slice) const | 76 Orthanc::Image* ImageBuffer3D::ExtractSagittalSlice(unsigned int slice) const |
77 { | 77 { |
78 //LOG(TRACE) << "ImageBuffer3D::ExtractSagittalSlice this= " << std::hex << this << std::dec << " width_ = " << width_ << " height_ = " << height_ << " depth_ = " << depth_ << " slice = " << slice; | |
78 if (slice >= width_) | 79 if (slice >= width_) |
79 { | 80 { |
80 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 81 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
81 } | 82 } |
82 | 83 |
83 std::auto_ptr<Orthanc::Image> result(new Orthanc::Image(format_, height_, depth_, false)); | 84 std::auto_ptr<Orthanc::Image> result(new Orthanc::Image(format_, height_, depth_, false)); |
85 //LOG(TRACE) << "ImageBuffer3D::ExtractSagittalSlice result will be an image of WIDTH = " << height_ << " and HEIGHT = " << depth_; | |
84 | 86 |
85 unsigned int bytesPerPixel = Orthanc::GetBytesPerPixel(format_); | 87 unsigned int bytesPerPixel = Orthanc::GetBytesPerPixel(format_); |
86 | 88 |
87 for (unsigned int z = 0; z < depth_; z++) | 89 for (unsigned int z = 0; z < depth_; z++) |
88 { | 90 { |
89 //uint8_t* target = reinterpret_cast<uint8_t*>(result->GetRow(depth_ - 1 - z)); | 91 //uint8_t* target = reinterpret_cast<uint8_t*>(result->GetRow(depth_ - 1 - z)); |
90 uint8_t* target = reinterpret_cast<uint8_t*>(result->GetRow(z)); | 92 uint8_t* target = reinterpret_cast<uint8_t*>(result->GetRow(z)); |
91 | 93 |
92 for (unsigned int y = 0; y < height_; y++) | 94 for (unsigned int y = 0; y < height_; y++) |
93 { | 95 { |
94 const void* source = (reinterpret_cast<const uint8_t*>(image_.GetConstRow(y + z * height_)) + | 96 const void* source = (reinterpret_cast<const uint8_t*>(image_.GetConstRow(y + z * height_)) + bytesPerPixel * slice); |
95 bytesPerPixel * slice); | 97 const uint8_t* byteSrc = reinterpret_cast<const uint8_t*>(source); |
96 | 98 for (size_t byte = 0; byte < bytesPerPixel; ++byte) |
97 memcpy(target, source, bytesPerPixel); | 99 target[byte] = byteSrc[byte]; |
98 target += bytesPerPixel; | 100 target += bytesPerPixel; |
99 } | 101 } |
100 } | 102 } |
101 | 103 |
102 return result.release(); | 104 return result.release(); |