comparison Framework/Layers/SeriesFrameRendererFactory.cpp @ 32:517c46f527cd

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Dec 2016 11:00:23 +0100
parents ff1e935768e7
children 7207a407bcd8
comparison
equal deleted inserted replaced
31:9aace933cb64 32:517c46f527cd
32 32
33 #include "SeriesFrameRendererFactory.h" 33 #include "SeriesFrameRendererFactory.h"
34 34
35 #include "FrameRenderer.h" 35 #include "FrameRenderer.h"
36 #include "../../Resources/Orthanc/Core/OrthancException.h" 36 #include "../../Resources/Orthanc/Core/OrthancException.h"
37 #include "../../Resources/Orthanc/Core/Logging.h"
38 #include "../../Resources/Orthanc/Core/Toolbox.h"
39 #include "../../Resources/Orthanc/Plugins/Samples/Common/OrthancPluginException.h"
40 #include "../../Resources/Orthanc/Plugins/Samples/Common/DicomDatasetReader.h"
41
37 42
38 namespace OrthancStone 43 namespace OrthancStone
39 { 44 {
40 void SeriesFrameRendererFactory::ReadCurrentFrameDataset(size_t frame) 45 void SeriesFrameRendererFactory::ReadCurrentFrameDataset(size_t frame)
41 { 46 {
64 { 69 {
65 // There was no previous call "ReadCurrentFrameDataset()" 70 // There was no previous call "ReadCurrentFrameDataset()"
66 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); 71 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
67 } 72 }
68 73
69 currentDataset_->GetPixelSpacing(spacingX, spacingY); 74 GeometryToolbox::GetPixelSpacing(spacingX, spacingY, *currentDataset_);
70 } 75 }
71 76
72 77
73 double SeriesFrameRendererFactory::GetCurrentSliceThickness() const 78 double SeriesFrameRendererFactory::GetCurrentSliceThickness() const
74 { 79 {
75 if (currentDataset_.get() == NULL) 80 if (currentDataset_.get() == NULL)
76 { 81 {
77 // There was no previous call "ReadCurrentFrameDataset()" 82 // There was no previous call "ReadCurrentFrameDataset()"
78 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); 83 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
79 } 84 }
80 85
81 if (currentDataset_->HasTag(DICOM_TAG_SLICE_THICKNESS)) 86 try
82 { 87 {
83 return currentDataset_->GetFloatValue(DICOM_TAG_SLICE_THICKNESS); 88 OrthancPlugins::DicomDatasetReader reader(*currentDataset_);
89
90 double thickness;
91 if (reader.GetDoubleValue(thickness, OrthancPlugins::DICOM_TAG_SLICE_THICKNESS))
92 {
93 return thickness;
94 }
84 } 95 }
85 else 96 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
86 { 97 {
87 // Some arbitrary large slice thickness
88 return std::numeric_limits<double>::infinity();
89 } 98 }
99
100 // Some arbitrary large slice thickness
101 return std::numeric_limits<double>::infinity();
90 } 102 }
91 103
92 104
93 SeriesFrameRendererFactory::SeriesFrameRendererFactory(ISeriesLoader* loader, // Takes ownership 105 SeriesFrameRendererFactory::SeriesFrameRendererFactory(ISeriesLoader* loader, // Takes ownership
94 bool fast) : 106 bool fast) :