# HG changeset patch # User Sebastien Jodogne # Date 1559111773 -7200 # Node ID 68f888812af47292ea4c6bcdb1b7e00782d963a9 # Parent 1f85e9c7d0200c343be6812b20e20b05a39f5225 simplification of DicomVolumeImageMPRSlicer::ExtractedSlice diff -r 1f85e9c7d020 -r 68f888812af4 Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp --- 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) diff -r 1f85e9c7d020 -r 68f888812af4 Framework/Volumes/DicomVolumeImageMPRSlicer.cpp --- 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) diff -r 1f85e9c7d020 -r 68f888812af4 Framework/Volumes/DicomVolumeImageMPRSlicer.h --- 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);