comparison OrthancServer/FromDcmtkBridge.cpp @ 789:55dae8c5a6ab

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 May 2014 18:43:34 +0200
parents 7ebe4bf87196
children 331eaf9d9d69
comparison
equal deleted inserted replaced
788:7ebe4bf87196 789:55dae8c5a6ab
782 } 782 }
783 783
784 784
785 void ParsedDicomFile::Replace(const DicomTag& tag, 785 void ParsedDicomFile::Replace(const DicomTag& tag,
786 const std::string& value, 786 const std::string& value,
787 FromDcmtkBridge::ReplaceMode mode) 787 DicomReplaceMode mode)
788 { 788 {
789 DcmTagKey key(tag.GetGroup(), tag.GetElement()); 789 DcmTagKey key(tag.GetGroup(), tag.GetElement());
790 DcmElement* element = NULL; 790 DcmElement* element = NULL;
791 791
792 if (!file_->getDataset()->findAndGetElement(key, element).good() || 792 if (!file_->getDataset()->findAndGetElement(key, element).good() ||
793 element == NULL) 793 element == NULL)
794 { 794 {
795 // This field does not exist, act wrt. the specified "mode" 795 // This field does not exist, act wrt. the specified "mode"
796 switch (mode) 796 switch (mode)
797 { 797 {
798 case FromDcmtkBridge::ReplaceMode_InsertIfAbsent: 798 case DicomReplaceMode_InsertIfAbsent:
799 Insert(tag, value); 799 Insert(tag, value);
800 break; 800 break;
801 801
802 case FromDcmtkBridge::ReplaceMode_ThrowIfAbsent: 802 case DicomReplaceMode_ThrowIfAbsent:
803 throw OrthancException(ErrorCode_InexistentItem); 803 throw OrthancException(ErrorCode_InexistentItem);
804 804
805 case FromDcmtkBridge::ReplaceMode_IgnoreIfAbsent: 805 case DicomReplaceMode_IgnoreIfAbsent:
806 return; 806 return;
807 } 807 }
808 } 808 }
809 else 809 else
810 { 810 {
821 * option. 821 * option.
822 **/ 822 **/
823 823
824 if (tag == DICOM_TAG_SOP_CLASS_UID) 824 if (tag == DICOM_TAG_SOP_CLASS_UID)
825 { 825 {
826 Replace(DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID, value, 826 Replace(DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID, value, DicomReplaceMode_InsertIfAbsent);
827 FromDcmtkBridge::ReplaceMode_InsertIfAbsent);
828 } 827 }
829 828
830 if (tag == DICOM_TAG_SOP_INSTANCE_UID) 829 if (tag == DICOM_TAG_SOP_INSTANCE_UID)
831 { 830 {
832 Replace(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID, value, 831 Replace(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID, value, DicomReplaceMode_InsertIfAbsent);
833 FromDcmtkBridge::ReplaceMode_InsertIfAbsent);
834 } 832 }
835 } 833 }
836 834
837 835
838 void ParsedDicomFile::Answer(RestApiOutput& output) 836 void ParsedDicomFile::Answer(RestApiOutput& output)