comparison Core/DicomParsing/DicomDirWriter.cpp @ 2475:8cc3ca64a534

Orthanc now uses UTC (universal time) instead of local time in its database
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Feb 2018 16:55:05 +0100
parents 878b59270859
children a84ce82fd55b
comparison
equal deleted inserted replaced
2474:0c57f40e2fbf 2475:8cc3ca64a534
126 namespace Orthanc 126 namespace Orthanc
127 { 127 {
128 class DicomDirWriter::PImpl 128 class DicomDirWriter::PImpl
129 { 129 {
130 private: 130 private:
131 bool utc_;
131 std::string fileSetId_; 132 std::string fileSetId_;
132 bool extendedSopClass_; 133 bool extendedSopClass_;
133 TemporaryFile file_; 134 TemporaryFile file_;
134 std::auto_ptr<DcmDicomDir> dir_; 135 std::auto_ptr<DcmDicomDir> dir_;
135 136
257 } 258 }
258 259
259 260
260 public: 261 public:
261 PImpl() : 262 PImpl() :
263 utc_(true), // By default, use UTC (universal time, not local time)
262 fileSetId_("ORTHANC_MEDIA"), 264 fileSetId_("ORTHANC_MEDIA"),
263 extendedSopClass_(false) 265 extendedSopClass_(false)
264 { 266 {
265 } 267 }
266 268
269 bool IsUtcUsed() const
270 {
271 return utc_;
272 }
273
274
275 void SetUtcUsed(bool utc)
276 {
277 utc_ = utc;
278 }
279
267 void EnableExtendedSopClass(bool enable) 280 void EnableExtendedSopClass(bool enable)
268 { 281 {
269 if (enable) 282 if (enable)
270 { 283 {
271 LOG(WARNING) << "Generating a DICOMDIR with type 3 attributes, " 284 LOG(WARNING) << "Generating a DICOMDIR with type 3 attributes, "
295 Encoding encoding) 308 Encoding encoding)
296 { 309 {
297 // cf. "DicomDirInterface::buildStudyRecord()" 310 // cf. "DicomDirInterface::buildStudyRecord()"
298 311
299 std::string nowDate, nowTime; 312 std::string nowDate, nowTime;
300 SystemToolbox::GetNowDicom(nowDate, nowTime); 313 SystemToolbox::GetNowDicom(nowDate, nowTime, utc_);
301 314
302 std::string studyDate; 315 std::string studyDate;
303 if (!GetUtf8TagValue(studyDate, dicom, encoding, DCM_StudyDate) && 316 if (!GetUtf8TagValue(studyDate, dicom, encoding, DCM_StudyDate) &&
304 !GetUtf8TagValue(studyDate, dicom, encoding, DCM_SeriesDate) && 317 !GetUtf8TagValue(studyDate, dicom, encoding, DCM_SeriesDate) &&
305 !GetUtf8TagValue(studyDate, dicom, encoding, DCM_AcquisitionDate) && 318 !GetUtf8TagValue(studyDate, dicom, encoding, DCM_AcquisitionDate) &&
492 { 505 {
493 if (pimpl_) 506 if (pimpl_)
494 { 507 {
495 delete pimpl_; 508 delete pimpl_;
496 } 509 }
510 }
511
512 void DicomDirWriter::SetUtcUsed(bool utc)
513 {
514 pimpl_->SetUtcUsed(utc);
515 }
516
517 bool DicomDirWriter::IsUtcUsed() const
518 {
519 return pimpl_->IsUtcUsed();
497 } 520 }
498 521
499 void DicomDirWriter::SetFileSetId(const std::string& id) 522 void DicomDirWriter::SetFileSetId(const std::string& id)
500 { 523 {
501 pimpl_->SetFileSetId(id); 524 pimpl_->SetFileSetId(id);