Mercurial > hg > orthanc-stone
changeset 1118:35e798b16b65
RadiographyDicomLayer: allow replacing low res image by high res image
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 04 Nov 2019 22:16:04 +0100 |
parents | 3924ddbbadda |
children | 6bc766eab0de |
files | Framework/Radiography/RadiographyDicomLayer.cpp Framework/Radiography/RadiographyDicomLayer.h Framework/Radiography/RadiographyLayer.cpp Framework/Radiography/RadiographyLayer.h Framework/Radiography/RadiographyScene.h |
diffstat | 5 files changed, 30 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyDicomLayer.cpp Mon Nov 04 12:47:13 2019 +0100 +++ b/Framework/Radiography/RadiographyDicomLayer.cpp Mon Nov 04 22:16:04 2019 +0100 @@ -111,6 +111,25 @@ BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); } + void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY) // Takes ownership + { + std::auto_ptr<Orthanc::ImageAccessor> raii(image); + + if (image == NULL) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); + } + + SetSize(image->GetWidth(), image->GetHeight()); + + source_ = raii; + ApplyConverter(); + + SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false); + + BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); + } + void RadiographyDicomLayer::SetDicomFrameConverter(Deprecated::DicomFrameConverter* converter) {
--- a/Framework/Radiography/RadiographyDicomLayer.h Mon Nov 04 12:47:13 2019 +0100 +++ b/Framework/Radiography/RadiographyDicomLayer.h Mon Nov 04 22:16:04 2019 +0100 @@ -80,6 +80,8 @@ void SetSourceImage(Orthanc::ImageAccessor* image); // Takes ownership + void SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY); // Takes ownership + const Orthanc::ImageAccessor* GetSourceImage() const {return source_.get();} // currently need this access to serialize scene in plain old data to send to a WASM worker const Deprecated::DicomFrameConverter& GetDicomFrameConverter() const {return *converter_;} // currently need this access to serialize scene in plain old data to send to a WASM worker
--- a/Framework/Radiography/RadiographyLayer.cpp Mon Nov 04 12:47:13 2019 +0100 +++ b/Framework/Radiography/RadiographyLayer.cpp Mon Nov 04 22:16:04 2019 +0100 @@ -313,11 +313,15 @@ void RadiographyLayer::SetPixelSpacing(double x, - double y) + double y, + bool emitLayerEditedEvent) { geometry_.SetPixelSpacing(x, y); UpdateTransform(); - BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); + if (emitLayerEditedEvent) + { + BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); + } }
--- a/Framework/Radiography/RadiographyLayer.h Mon Nov 04 12:47:13 2019 +0100 +++ b/Framework/Radiography/RadiographyLayer.h Mon Nov 04 22:16:04 2019 +0100 @@ -323,7 +323,8 @@ double sceneY) const; void SetPixelSpacing(double x, - double y); + double y, + bool emitLayerEditedEvent = true); void GetCenter(double& centerX, double& centerY) const;
--- a/Framework/Radiography/RadiographyScene.h Mon Nov 04 12:47:13 2019 +0100 +++ b/Framework/Radiography/RadiographyScene.h Mon Nov 04 22:16:04 2019 +0100 @@ -149,7 +149,7 @@ protected: RadiographyLayer& RegisterLayer(RadiographyLayer* layer); - void OnTagsReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message); + virtual void OnTagsReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message); virtual void OnFrameReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message);