# HG changeset patch # User Benjamin Golinvaux # Date 1572967868 -3600 # Node ID 0073f95a1df1269e04c8d907db0a8c7e1ef9fef8 # Parent 11b7785dd01b0c2e72ef44f6b1b7fa88d2fe7fa0# Parent 6bc766eab0dea3aea866638b17c0420e59df0304 merge diff -r 11b7785dd01b -r 0073f95a1df1 Framework/Radiography/RadiographyDicomLayer.cpp --- a/Framework/Radiography/RadiographyDicomLayer.cpp Tue Nov 05 16:30:45 2019 +0100 +++ b/Framework/Radiography/RadiographyDicomLayer.cpp Tue Nov 05 16:31:08 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 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) { diff -r 11b7785dd01b -r 0073f95a1df1 Framework/Radiography/RadiographyDicomLayer.h --- a/Framework/Radiography/RadiographyDicomLayer.h Tue Nov 05 16:30:45 2019 +0100 +++ b/Framework/Radiography/RadiographyDicomLayer.h Tue Nov 05 16:31:08 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 diff -r 11b7785dd01b -r 0073f95a1df1 Framework/Radiography/RadiographyLayer.cpp --- a/Framework/Radiography/RadiographyLayer.cpp Tue Nov 05 16:30:45 2019 +0100 +++ b/Framework/Radiography/RadiographyLayer.cpp Tue Nov 05 16:31:08 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)); + } } diff -r 11b7785dd01b -r 0073f95a1df1 Framework/Radiography/RadiographyLayer.h --- a/Framework/Radiography/RadiographyLayer.h Tue Nov 05 16:30:45 2019 +0100 +++ b/Framework/Radiography/RadiographyLayer.h Tue Nov 05 16:31:08 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; diff -r 11b7785dd01b -r 0073f95a1df1 Framework/Radiography/RadiographyScene.h --- a/Framework/Radiography/RadiographyScene.h Tue Nov 05 16:30:45 2019 +0100 +++ b/Framework/Radiography/RadiographyScene.h Tue Nov 05 16:31:08 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);