# HG changeset patch # User am@osimis.io # Date 1544093617 -3600 # Node ID 04711a2e12cdd084e8ff6f3d6c0ad0f63a340023 # Parent e641d39788568b453f11a9f825dbc37fb47e7e51 fix crop + export photometric interpretation correctly diff -r e641d3978856 -r 04711a2e12cd Framework/Radiography/RadiographyLayer.cpp --- 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_; diff -r e641d3978856 -r 04711a2e12cd Framework/Radiography/RadiographyLayer.h --- 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; diff -r e641d3978856 -r 04711a2e12cd Framework/Radiography/RadiographyLayerCropTracker.cpp --- 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_); } } diff -r e641d3978856 -r 04711a2e12cd Framework/Radiography/RadiographyScene.cpp --- 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,