view Core/Enumerations_TransferSyntaxes.impl.h @ 3730:ae31ba2b09a6

toolbox: LookupTransferSyntax()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Mar 2020 15:06:22 +0100
parents
children
line wrap: on
line source

/**
 * 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 General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * In addition, as a special exception, the copyright holders of this
 * program give permission to link the code of its release with the
 * OpenSSL project's "OpenSSL" library (or with modified versions of it
 * that use the same license as the "OpenSSL" library), and distribute
 * the linked executables. You must obey the GNU General Public License
 * in all respects for all of the code used other than "OpenSSL". If you
 * modify file(s) with this exception, you may extend this exception to
 * your version of the file(s), but you are not obligated to do so. If
 * you do not wish to do so, delete this exception statement from your
 * version. If you delete this exception statement from all source files
 * in the program, then also delete it here.
 * 
 * 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 **/

// This file is autogenerated by "../Resources/GenerateTransferSyntaxes.py"

namespace Orthanc
{
  const char* GetTransferSyntaxUid(DicomTransferSyntax syntax)
  {
    switch (syntax)
    {
      case DicomTransferSyntax_LittleEndianImplicit:
        return "1.2.840.10008.1.2";

      case DicomTransferSyntax_LittleEndianExplicit:
        return "1.2.840.10008.1.2.1";

      case DicomTransferSyntax_DeflatedLittleEndianExplicit:
        return "1.2.840.10008.1.2.1.99";

      case DicomTransferSyntax_BigEndianExplicit:
        return "1.2.840.10008.1.2.2";

      case DicomTransferSyntax_JPEGProcess1:
        return "1.2.840.10008.1.2.4.50";

      case DicomTransferSyntax_JPEGProcess2_4:
        return "1.2.840.10008.1.2.4.51";

      case DicomTransferSyntax_JPEGProcess3_5:
        return "1.2.840.10008.1.2.4.52";

      case DicomTransferSyntax_JPEGProcess6_8:
        return "1.2.840.10008.1.2.4.53";

      case DicomTransferSyntax_JPEGProcess7_9:
        return "1.2.840.10008.1.2.4.54";

      case DicomTransferSyntax_JPEGProcess10_12:
        return "1.2.840.10008.1.2.4.55";

      case DicomTransferSyntax_JPEGProcess11_13:
        return "1.2.840.10008.1.2.4.56";

      case DicomTransferSyntax_JPEGProcess14:
        return "1.2.840.10008.1.2.4.57";

      case DicomTransferSyntax_JPEGProcess15:
        return "1.2.840.10008.1.2.4.58";

      case DicomTransferSyntax_JPEGProcess16_18:
        return "1.2.840.10008.1.2.4.59";

      case DicomTransferSyntax_JPEGProcess17_19:
        return "1.2.840.10008.1.2.4.60";

      case DicomTransferSyntax_JPEGProcess20_22:
        return "1.2.840.10008.1.2.4.61";

      case DicomTransferSyntax_JPEGProcess21_23:
        return "1.2.840.10008.1.2.4.62";

      case DicomTransferSyntax_JPEGProcess24_26:
        return "1.2.840.10008.1.2.4.63";

      case DicomTransferSyntax_JPEGProcess25_27:
        return "1.2.840.10008.1.2.4.64";

      case DicomTransferSyntax_JPEGProcess28:
        return "1.2.840.10008.1.2.4.65";

      case DicomTransferSyntax_JPEGProcess29:
        return "1.2.840.10008.1.2.4.66";

      case DicomTransferSyntax_JPEGProcess14SV1:
        return "1.2.840.10008.1.2.4.70";

      case DicomTransferSyntax_JPEGLSLossless:
        return "1.2.840.10008.1.2.4.80";

      case DicomTransferSyntax_JPEGLSLossy:
        return "1.2.840.10008.1.2.4.81";

      case DicomTransferSyntax_JPEG2000LosslessOnly:
        return "1.2.840.10008.1.2.4.90";

      case DicomTransferSyntax_JPEG2000:
        return "1.2.840.10008.1.2.4.91";

      case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly:
        return "1.2.840.10008.1.2.4.92";

      case DicomTransferSyntax_JPEG2000Multicomponent:
        return "1.2.840.10008.1.2.4.93";

      case DicomTransferSyntax_JPIPReferenced:
        return "1.2.840.10008.1.2.4.94";

      case DicomTransferSyntax_JPIPReferencedDeflate:
        return "1.2.840.10008.1.2.4.95";

      case DicomTransferSyntax_MPEG2MainProfileAtMainLevel:
        return "1.2.840.10008.1.2.4.100";

      case DicomTransferSyntax_MPEG2MainProfileAtHighLevel:
        return "1.2.840.10008.1.2.4.101";

      case DicomTransferSyntax_MPEG4HighProfileLevel4_1:
        return "1.2.840.10008.1.2.4.102";

      case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1:
        return "1.2.840.10008.1.2.4.103";

      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo:
        return "1.2.840.10008.1.2.4.104";

      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo:
        return "1.2.840.10008.1.2.4.105";

      case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2:
        return "1.2.840.10008.1.2.4.106";

      case DicomTransferSyntax_HEVCMainProfileLevel5_1:
        return "1.2.840.10008.1.2.4.107";

      case DicomTransferSyntax_HEVCMain10ProfileLevel5_1:
        return "1.2.840.10008.1.2.4.108";

      case DicomTransferSyntax_RLELossless:
        return "1.2.840.10008.1.2.5";

      case DicomTransferSyntax_RFC2557MimeEncapsulation:
        return "1.2.840.10008.1.2.6.1";

      case DicomTransferSyntax_XML:
        return "1.2.840.10008.1.2.6.2";

      default:
        throw OrthancException(ErrorCode_ParameterOutOfRange);
    }
  }


  bool IsRetiredTransferSyntax(DicomTransferSyntax syntax)
  {
    switch (syntax)
    {
      case DicomTransferSyntax_LittleEndianImplicit:
        return false;

      case DicomTransferSyntax_LittleEndianExplicit:
        return false;

      case DicomTransferSyntax_DeflatedLittleEndianExplicit:
        return false;

      case DicomTransferSyntax_BigEndianExplicit:
        return false;

      case DicomTransferSyntax_JPEGProcess1:
        return false;

      case DicomTransferSyntax_JPEGProcess2_4:
        return false;

      case DicomTransferSyntax_JPEGProcess3_5:
        return true;

      case DicomTransferSyntax_JPEGProcess6_8:
        return true;

      case DicomTransferSyntax_JPEGProcess7_9:
        return true;

      case DicomTransferSyntax_JPEGProcess10_12:
        return true;

      case DicomTransferSyntax_JPEGProcess11_13:
        return true;

      case DicomTransferSyntax_JPEGProcess14:
        return false;

      case DicomTransferSyntax_JPEGProcess15:
        return true;

      case DicomTransferSyntax_JPEGProcess16_18:
        return true;

      case DicomTransferSyntax_JPEGProcess17_19:
        return true;

      case DicomTransferSyntax_JPEGProcess20_22:
        return true;

      case DicomTransferSyntax_JPEGProcess21_23:
        return true;

      case DicomTransferSyntax_JPEGProcess24_26:
        return true;

      case DicomTransferSyntax_JPEGProcess25_27:
        return true;

      case DicomTransferSyntax_JPEGProcess28:
        return true;

      case DicomTransferSyntax_JPEGProcess29:
        return true;

      case DicomTransferSyntax_JPEGProcess14SV1:
        return false;

      case DicomTransferSyntax_JPEGLSLossless:
        return false;

      case DicomTransferSyntax_JPEGLSLossy:
        return false;

      case DicomTransferSyntax_JPEG2000LosslessOnly:
        return false;

      case DicomTransferSyntax_JPEG2000:
        return false;

      case DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly:
        return false;

      case DicomTransferSyntax_JPEG2000Multicomponent:
        return false;

      case DicomTransferSyntax_JPIPReferenced:
        return false;

      case DicomTransferSyntax_JPIPReferencedDeflate:
        return false;

      case DicomTransferSyntax_MPEG2MainProfileAtMainLevel:
        return false;

      case DicomTransferSyntax_MPEG2MainProfileAtHighLevel:
        return false;

      case DicomTransferSyntax_MPEG4HighProfileLevel4_1:
        return false;

      case DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1:
        return false;

      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo:
        return false;

      case DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo:
        return false;

      case DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2:
        return false;

      case DicomTransferSyntax_HEVCMainProfileLevel5_1:
        return false;

      case DicomTransferSyntax_HEVCMain10ProfileLevel5_1:
        return false;

      case DicomTransferSyntax_RLELossless:
        return false;

      case DicomTransferSyntax_RFC2557MimeEncapsulation:
        return true;

      case DicomTransferSyntax_XML:
        return true;

      default:
        throw OrthancException(ErrorCode_ParameterOutOfRange);
    }
  }


  bool LookupTransferSyntax(DicomTransferSyntax& target,
                            const std::string& uid)
  {
    if (uid == "1.2.840.10008.1.2")
    {
      target = DicomTransferSyntax_LittleEndianImplicit;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.1")
    {
      target = DicomTransferSyntax_LittleEndianExplicit;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.1.99")
    {
      target = DicomTransferSyntax_DeflatedLittleEndianExplicit;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.2")
    {
      target = DicomTransferSyntax_BigEndianExplicit;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.50")
    {
      target = DicomTransferSyntax_JPEGProcess1;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.51")
    {
      target = DicomTransferSyntax_JPEGProcess2_4;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.52")
    {
      target = DicomTransferSyntax_JPEGProcess3_5;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.53")
    {
      target = DicomTransferSyntax_JPEGProcess6_8;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.54")
    {
      target = DicomTransferSyntax_JPEGProcess7_9;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.55")
    {
      target = DicomTransferSyntax_JPEGProcess10_12;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.56")
    {
      target = DicomTransferSyntax_JPEGProcess11_13;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.57")
    {
      target = DicomTransferSyntax_JPEGProcess14;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.58")
    {
      target = DicomTransferSyntax_JPEGProcess15;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.59")
    {
      target = DicomTransferSyntax_JPEGProcess16_18;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.60")
    {
      target = DicomTransferSyntax_JPEGProcess17_19;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.61")
    {
      target = DicomTransferSyntax_JPEGProcess20_22;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.62")
    {
      target = DicomTransferSyntax_JPEGProcess21_23;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.63")
    {
      target = DicomTransferSyntax_JPEGProcess24_26;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.64")
    {
      target = DicomTransferSyntax_JPEGProcess25_27;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.65")
    {
      target = DicomTransferSyntax_JPEGProcess28;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.66")
    {
      target = DicomTransferSyntax_JPEGProcess29;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.70")
    {
      target = DicomTransferSyntax_JPEGProcess14SV1;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.80")
    {
      target = DicomTransferSyntax_JPEGLSLossless;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.81")
    {
      target = DicomTransferSyntax_JPEGLSLossy;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.90")
    {
      target = DicomTransferSyntax_JPEG2000LosslessOnly;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.91")
    {
      target = DicomTransferSyntax_JPEG2000;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.92")
    {
      target = DicomTransferSyntax_JPEG2000MulticomponentLosslessOnly;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.93")
    {
      target = DicomTransferSyntax_JPEG2000Multicomponent;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.94")
    {
      target = DicomTransferSyntax_JPIPReferenced;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.95")
    {
      target = DicomTransferSyntax_JPIPReferencedDeflate;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.100")
    {
      target = DicomTransferSyntax_MPEG2MainProfileAtMainLevel;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.101")
    {
      target = DicomTransferSyntax_MPEG2MainProfileAtHighLevel;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.102")
    {
      target = DicomTransferSyntax_MPEG4HighProfileLevel4_1;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.103")
    {
      target = DicomTransferSyntax_MPEG4BDcompatibleHighProfileLevel4_1;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.104")
    {
      target = DicomTransferSyntax_MPEG4HighProfileLevel4_2_For2DVideo;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.105")
    {
      target = DicomTransferSyntax_MPEG4HighProfileLevel4_2_For3DVideo;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.106")
    {
      target = DicomTransferSyntax_MPEG4StereoHighProfileLevel4_2;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.107")
    {
      target = DicomTransferSyntax_HEVCMainProfileLevel5_1;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.4.108")
    {
      target = DicomTransferSyntax_HEVCMain10ProfileLevel5_1;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.5")
    {
      target = DicomTransferSyntax_RLELossless;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.6.1")
    {
      target = DicomTransferSyntax_RFC2557MimeEncapsulation;
      return true;
    }
    
    if (uid == "1.2.840.10008.1.2.6.2")
    {
      target = DicomTransferSyntax_XML;
      return true;
    }
    
    return false;
  }
}