Mercurial > hg > orthanc-stone
changeset 436:04711a2e12cd am-vsol-upgrade
fix crop + export photometric interpretation correctly
author | am@osimis.io |
---|---|
date | Thu, 06 Dec 2018 11:53:37 +0100 |
parents | e641d3978856 |
children | 8f7220433b59 |
files | Framework/Radiography/RadiographyLayer.cpp Framework/Radiography/RadiographyLayer.h Framework/Radiography/RadiographyLayerCropTracker.cpp Framework/Radiography/RadiographyScene.cpp |
diffstat | 4 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyLayer.cpp Tue Dec 04 11:52:43 2018 +0100 +++ b/Framework/Radiography/RadiographyLayer.cpp Thu Dec 06 11:53:37 2018 +0100 @@ -47,7 +47,7 @@ void RadiographyLayer::Geometry::GetCrop(unsigned int &x, unsigned int &y, unsigned int &width, unsigned int &height) const { if (!hasCrop_) - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); // you should probably use Radiography::GetCrop() or at least call HasCrop() before + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); // you should probably use RadiographyLayer::GetCrop() or at least call HasCrop() before x = cropX_; y = cropY_;
--- a/Framework/Radiography/RadiographyLayer.h Tue Dec 04 11:52:43 2018 +0100 +++ b/Framework/Radiography/RadiographyLayer.h Thu Dec 06 11:53:37 2018 +0100 @@ -59,6 +59,7 @@ unsigned int width, unsigned int height) { + hasCrop_ = true; cropX_ = x; cropY_ = y; cropWidth_ = width;
--- a/Framework/Radiography/RadiographyLayerCropTracker.cpp Tue Dec 04 11:52:43 2018 +0100 +++ b/Framework/Radiography/RadiographyLayerCropTracker.cpp Thu Dec 06 11:53:37 2018 +0100 @@ -58,7 +58,7 @@ sourceCropWidth_(tracker.cropWidth_), sourceCropHeight_(tracker.cropHeight_) { - tracker.accessor_.GetLayer().GetGeometry().GetCrop(targetCropX_, targetCropY_, + tracker.accessor_.GetLayer().GetCrop(targetCropX_, targetCropY_, targetCropWidth_, targetCropHeight_); } }; @@ -77,7 +77,7 @@ { if (accessor_.IsValid()) { - accessor_.GetLayer().GetGeometry().GetCrop(cropX_, cropY_, cropWidth_, cropHeight_); + accessor_.GetLayer().GetCrop(cropX_, cropY_, cropWidth_, cropHeight_); } }
--- a/Framework/Radiography/RadiographyScene.cpp Tue Dec 04 11:52:43 2018 +0100 +++ b/Framework/Radiography/RadiographyScene.cpp Thu Dec 06 11:53:37 2018 +0100 @@ -628,8 +628,16 @@ } } - createDicomRequestContent["Tags"][Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION.Format()] = - (invert ? "MONOCHROME1" : "MONOCHROME2"); + PhotometricDisplayMode photometricMode = GetPreferredPhotomotricDisplayMode(); + if ((invert && photometricMode != PhotometricDisplayMode_Monochrome2) || + (!invert && photometricMode == PhotometricDisplayMode_Monochrome1)) + { + createDicomRequestContent["Tags"][Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION.Format()] = "MONOCHROME1"; + } + else + { + createDicomRequestContent["Tags"][Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION.Format()] = "MONOCHROME2"; + } // WARNING: The order of PixelSpacing is Y/X. We use "%0.8f" to // avoid floating-point numbers to grow over 16 characters,