Mercurial > hg > orthanc-stone
changeset 817:68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 29 May 2019 08:36:13 +0200 |
parents | 1f85e9c7d020 |
children | e42b491f1fb2 a68cd7ae8838 |
files | Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Framework/Volumes/DicomVolumeImageMPRSlicer.cpp Framework/Volumes/DicomVolumeImageMPRSlicer.h |
diffstat | 3 files changed, 22 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Tue May 28 22:18:41 2019 +0200 +++ b/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Wed May 29 08:36:13 2019 +0200 @@ -36,30 +36,21 @@ private: const OrthancSeriesVolumeProgressiveLoader& that_; - protected: - virtual uint64_t GetRevisionInternal(VolumeProjection projection, - unsigned int sliceIndex) const - { - if (projection == VolumeProjection_Axial) - { - return that_.seriesGeometry_.GetSliceRevision(sliceIndex); - } - else - { - // For coronal and sagittal projections, we take the global - // revision of the volume because even if a single slice changes, - // this means the projection will yield a different result --> - // we must increase the revision as soon as any slice changes - return that_.volume_->GetRevision(); - } - } - public: ExtractedSlice(const OrthancSeriesVolumeProgressiveLoader& that, const CoordinateSystem3D& plane) : DicomVolumeImageMPRSlicer::Slice(*that.volume_, plane), that_(that) { + if (GetProjection() == VolumeProjection_Axial) + { + // For coronal and sagittal projections, we take the global + // revision of the volume because even if a single slice changes, + // this means the projection will yield a different result --> + // we must increase the revision as soon as any slice changes + SetRevision(that_.seriesGeometry_.GetSliceRevision(GetSliceIndex())); + } + if (that_.strategy_.get() != NULL && IsValid() && GetProjection() == VolumeProjection_Axial)
--- a/Framework/Volumes/DicomVolumeImageMPRSlicer.cpp Tue May 28 22:18:41 2019 +0200 +++ b/Framework/Volumes/DicomVolumeImageMPRSlicer.cpp Wed May 29 08:36:13 2019 +0200 @@ -36,7 +36,8 @@ DicomVolumeImageMPRSlicer::Slice::Slice(const DicomVolumeImage& volume, const CoordinateSystem3D& cuttingPlane) : - volume_(volume) + volume_(volume), + revision_(volume_.GetRevision()) { valid_ = (volume_.HasDicomParameters() && volume_.GetGeometry().DetectSlice(projection_, sliceIndex_, cuttingPlane)); @@ -55,13 +56,7 @@ CheckValid(); return sliceIndex_; } - - uint64_t DicomVolumeImageMPRSlicer::Slice::GetRevision() - { - CheckValid(); - return GetRevisionInternal(projection_, sliceIndex_); - } - + ISceneLayer* DicomVolumeImageMPRSlicer::Slice::CreateSceneLayer(const ILayerStyleConfigurator* configurator, const CoordinateSystem3D& cuttingPlane)
--- a/Framework/Volumes/DicomVolumeImageMPRSlicer.h Tue May 28 22:18:41 2019 +0200 +++ b/Framework/Volumes/DicomVolumeImageMPRSlicer.h Wed May 29 08:36:13 2019 +0200 @@ -40,20 +40,13 @@ { private: const DicomVolumeImage& volume_; + uint64_t revision_; bool valid_; VolumeProjection projection_; unsigned int sliceIndex_; void CheckValid() const; - protected: - // Can be overloaded in subclasses - virtual uint64_t GetRevisionInternal(VolumeProjection projection, - unsigned int sliceIndex) const - { - return volume_.GetRevision(); - } - public: /** Represents a slice of a volume image that is parallel to the @@ -64,6 +57,11 @@ Slice(const DicomVolumeImage& volume, const CoordinateSystem3D& cuttingPlane); + void SetRevision(uint64_t revision) + { + revision_ = revision; + } + VolumeProjection GetProjection() const; unsigned int GetSliceIndex() const; @@ -73,7 +71,10 @@ return valid_; } - virtual uint64_t GetRevision(); + virtual uint64_t GetRevision() + { + return revision_; + } virtual ISceneLayer* CreateSceneLayer(const ILayerStyleConfigurator* configurator, const CoordinateSystem3D& cuttingPlane);