DicomWebStorge/Orthanc-1.7.4/OrthancFramework/Resources/Graveyard/FromDcmtkBridge.cpp
/**
 * Orthanc - A Lightweight, RESTful DICOM Store
 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 * Department, University Hospital of Liege, Belgium
 * Copyright (C) 2017-2020 Osimis S.A., Belgium
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 **/
A Lightweight, RESTful DICOM Store
Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
Department, University Hospital of Liege, Belgium
Copyright (C) 2017-2020 Osimis S.A., Belgium

This program is free software: you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see
.
A Lightweight RESTful DICOM Store Copyright ( C ) 2012 - 2016 Sebastien Jodogne Medical Physics Department University Hospital of Liege Belgium Copyright ( C ) 2017 - 2020 Osimis S . A . Belgium This program is free software : you can redistribute it and / or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation either version 3 of the License or ( at your option ) any later version . This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU Lesser General Public License for more details . You should have received a copy of the GNU Lesser General Public License along with this program . If not see .
DcmElement* FromDcmtkBridge::CreateElementForTag(const DicomTag& tag)
  {
    DcmTag key(tag.GetGroup(), tag.GetElement());
    if (tag.IsPrivate())
    {
      LOG(WARNING) << "You are using DCMTK < 3.6.1: All the private tags "
        "are considered as having a binary value representation";
      return new DcmOtherByteOtherWord(key);
    }
    else if (IsBinaryTag(key))
    {
      return new DcmOtherByteOtherWord(key);
    }
    switch (key.getEVR())
    {
#if DCMTK_VERSION_NUMBER >= 361
      case EVR_OD:
#endif            
#if DCMTK_VERSION_NUMBER >= 362
      case EVR_OL:
#endif            
      case EVR_OB:  
      case EVR_OF:  
      case EVR_OW:  
      case EVR_UN:  
      case EVR_ox:  
        throw OrthancException(ErrorCode_InternalError);
      case EVR_AS:  
        return new DcmAgeString(key);
      case EVR_AE:  
        return new DcmApplicationEntity(key);
      case EVR_CS:  
        return new DcmCodeString(key);        
      case EVR_DA:  
        return new DcmDate(key);
      case EVR_DT:  
        return new DcmDateTime(key);
      case EVR_DS:  
        return new DcmDecimalString(key);
      case EVR_IS:  
        return new DcmIntegerString(key);
      case EVR_TM:  
        return new DcmTime(key);
      case EVR_UI:  
        return new DcmUniqueIdentifier(key);
      case EVR_ST:  
        return new DcmShortText(key);
      case EVR_LO:  
        return new DcmLongString(key);
      case EVR_LT:  
        return new DcmLongText(key);
      case EVR_UT:  
        return new DcmUnlimitedText(key);
      case EVR_SH:  
        return new DcmShortString(key);
      case EVR_PN:  
        return new DcmPersonName(key);
#if DCMTK_VERSION_NUMBER >= 361
      case EVR_UC:  
        return new DcmUnlimitedCharacters(key);
#endif
#if DCMTK_VERSION_NUMBER >= 361
      case EVR_UR:  
        return new DcmUniversalResourceIdentifierOrLocator(key);
#endif
      case EVR_SL:  
        return new DcmSignedLong(key);
      case EVR_SS:  
        return new DcmSignedShort(key);
      case EVR_UL:  
        return new DcmUnsignedLong(key);
      case EVR_US:  
        return new DcmUnsignedShort(key);
      case EVR_FL:  
        return new DcmFloatingPointSingle(key);
      case EVR_FD:  
        return new DcmFloatingPointDouble(key);
      case EVR_SQ:  
        throw OrthancException(ErrorCode_ParameterOutOfRange);
      case EVR_AT:  
        throw OrthancException(ErrorCode_NotImplemented);
      case EVR_xs:  
      case EVR_lt:  
      case EVR_na:  
      case EVR_up:  
      case EVR_item:  
      case EVR_metainfo:  
      case EVR_dataset:  
      case EVR_fileFormat:  
      case EVR_dicomDir:  
      case EVR_dirRecord:  
      case EVR_pixelSQ:  
      case EVR_pixelItem:  
      case EVR_UNKNOWN: 
      case EVR_PixelData:  
      case EVR_OverlayData:  
      case EVR_UNKNOWN2B:  
      default:
        break;
    }
    throw OrthancException(ErrorCode_InternalError);
  }
DcmElement * FromDcmtkBridge :: CreateElementForTag ( const DicomTag & tag ) { DcmTag key ( tag . GetGroup ( ) , tag . GetElement ( ) ) ; if ( tag . IsPrivate ( ) ) { LOG ( WARNING ) << " " " " ; return new DcmOtherByteOtherWord ( key ) ; } else if ( IsBinaryTag ( key ) ) { return new DcmOtherByteOtherWord ( key ) ; } switch ( key . getEVR ( ) ) { #if DCMTK_VERSION_NUMBER >= 361 case EVR_OD : #endif #if DCMTK_VERSION_NUMBER >= 362 case EVR_OL : #endif case EVR_OB : case EVR_OF : case EVR_OW : case EVR_UN : case EVR_ox : throw OrthancException ( ErrorCode_InternalError ) ; case EVR_AS : return new DcmAgeString ( key ) ; case EVR_AE : return new DcmApplicationEntity ( key ) ; case EVR_CS : return new DcmCodeString ( key ) ; case EVR_DA : return new DcmDate ( key ) ; case EVR_DT : return new DcmDateTime ( key ) ; case EVR_DS : return new DcmDecimalString ( key ) ; case EVR_IS : return new DcmIntegerString ( key ) ; case EVR_TM : return new DcmTime ( key ) ; case EVR_UI : return new DcmUniqueIdentifier ( key ) ; case EVR_ST : return new DcmShortText ( key ) ; case EVR_LO : return new DcmLongString ( key ) ; case EVR_LT : return new DcmLongText ( key ) ; case EVR_UT : return new DcmUnlimitedText ( key ) ; case EVR_SH : return new DcmShortString ( key ) ; case EVR_PN : return new DcmPersonName ( key ) ; #if DCMTK_VERSION_NUMBER >= 361 case EVR_UC : return new DcmUnlimitedCharacters ( key ) ; #endif #if DCMTK_VERSION_NUMBER >= 361 case EVR_UR : return new DcmUniversalResourceIdentifierOrLocator ( key ) ; #endif case EVR_SL : return new DcmSignedLong ( key ) ; case EVR_SS : return new DcmSignedShort ( key ) ; case EVR_UL : return new DcmUnsignedLong ( key ) ; case EVR_US : return new DcmUnsignedShort ( key ) ; case EVR_FL : return new DcmFloatingPointSingle ( key ) ; case EVR_FD : return new DcmFloatingPointDouble ( key ) ; case EVR_SQ : throw OrthancException ( ErrorCode_ParameterOutOfRange ) ; case EVR_AT : throw OrthancException ( ErrorCode_NotImplemented ) ; case EVR_xs : case EVR_lt : case EVR_na : case EVR_up : case EVR_item : case EVR_metainfo : case EVR_dataset : case EVR_fileFormat : case EVR_dicomDir : case EVR_dirRecord : case EVR_pixelSQ : case EVR_pixelItem : case EVR_UNKNOWN : case EVR_PixelData : case EVR_OverlayData : case EVR_UNKNOWN2B : default : break ; } throw OrthancException ( ErrorCode_InternalError ) ; }
Orthanc - A Lightweight, RESTful DICOM Store
 Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
 Department, University Hospital of Liege, Belgium
 Copyright (C) 2017-2020 Osimis S.A., Belgium
Orthanc - A Lightweight RESTful DICOM Store Copyright ( C ) 2012 - 2016 Sebastien Jodogne Medical Physics Department University Hospital of Liege Belgium Copyright ( C ) 2017 - 2020 Osimis S . A . Belgium
// This raises BitBucket issue 140 (Modifying private tags with // REST API changes VR from LO to UN) // https://bitbucket.org/sjodogne/orthanc/issues/140 // http://support.dcmtk.org/docs/dcvr_8h-source.html /**
       * Binary types, handled above
       **/ // other byte // other float // other word // unknown value representation // OB or OW depending on context /**
       * String types.
       * http://support.dcmtk.org/docs/classDcmByteString.html
       **/ // age string // application entity title // code string // date string // date time string // decimal string // integer string // time string // unique identifier // short text // long string // long text // unlimited text // short string // person name // unlimited characters // URI/URL /**
       * Numerical types
       **/ // signed long // signed short // unsigned long // unsigned short // float single-precision // float double-precision /**
       * Sequence types, should never occur at this point.
       **/ // sequence of items /**
       * TODO
       **/ // attribute tag /**
       * Internal to DCMTK.
       **/ // SS or US depending on context // US, SS or OW depending on context, used for LUT Data (thus the name) // na="not applicable", for data which has no VR // up="unsigned pointer", used internally for DICOMDIR suppor // used internally for items // used internally for meta info datasets // used internally for datasets // used internally for DICOM files // used internally for DICOMDIR objects // used internally for DICOMDIR records // used internally for pixel sequences in a compressed image // used internally for pixel items in a compressed image // used internally for elements with unknown VR (encoded with 4-byte length field in explicit VR) // used internally for uncompressed pixeld data // used internally for overlay data // used internally for elements with unknown VR with 2-byte length field in explicit VR