Mercurial > hg > orthanc-dicomweb
view Plugin/Dicom.h @ 100:efd37f53a800
2016
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 Jan 2016 13:32:22 +0100 |
parents | 2bd3bf4d95bb |
children | 4fa66776ba09 |
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 * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero 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 * Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. **/ #pragma once #include "Configuration.h" #include "../Orthanc/Core/Enumerations.h" #include <gdcmReader.h> #include <gdcmDataSet.h> #include <pugixml.hpp> #include <gdcmDict.h> #include <list> namespace OrthancPlugins { static const gdcm::Tag DICOM_TAG_SOP_CLASS_UID(0x0008, 0x0016); static const gdcm::Tag DICOM_TAG_SOP_INSTANCE_UID(0x0008, 0x0018); static const gdcm::Tag DICOM_TAG_STUDY_INSTANCE_UID(0x0020, 0x000d); static const gdcm::Tag DICOM_TAG_SERIES_INSTANCE_UID(0x0020, 0x000e); static const gdcm::Tag DICOM_TAG_REFERENCED_SOP_CLASS_UID(0x0008, 0x1150); static const gdcm::Tag DICOM_TAG_REFERENCED_SOP_INSTANCE_UID(0x0008, 0x1155); static const gdcm::Tag DICOM_TAG_RETRIEVE_URL(0x0008, 0x1190); static const gdcm::Tag DICOM_TAG_FAILED_SOP_SEQUENCE(0x0008, 0x1198); static const gdcm::Tag DICOM_TAG_FAILURE_REASON(0x0008, 0x1197); static const gdcm::Tag DICOM_TAG_WARNING_REASON(0x0008, 0x1196); static const gdcm::Tag DICOM_TAG_REFERENCED_SOP_SEQUENCE(0x0008, 0x1199); static const gdcm::Tag DICOM_TAG_ACCESSION_NUMBER(0x0008, 0x0050); static const gdcm::Tag DICOM_TAG_SPECIFIC_CHARACTER_SET(0x0008, 0x0005); static const gdcm::Tag DICOM_TAG_PIXEL_DATA(0x7fe0, 0x0010); static const gdcm::Tag DICOM_TAG_COLUMNS(0x0028, 0x0011); static const gdcm::Tag DICOM_TAG_ROWS(0x0028, 0x0010); static const gdcm::Tag DICOM_TAG_BITS_ALLOCATED(0x0028, 0x0100); class ParsedDicomFile { private: gdcm::Reader reader_; void Setup(const std::string& dicom); public: ParsedDicomFile(const OrthancPlugins::MultipartItem& item); ParsedDicomFile(const std::string& dicom) { Setup(dicom); } const gdcm::File& GetFile() const { return reader_.GetFile(); } const gdcm::DataSet& GetDataSet() const { return reader_.GetFile().GetDataSet(); } bool GetRawTag(std::string& result, const gdcm::Tag& tag, bool stripSpaces) const; std::string GetRawTagWithDefault(const gdcm::Tag& tag, const std::string& defaultValue, bool stripSpaces) const; bool GetStringTag(std::string& result, const gdcm::Dict& dictionary, const gdcm::Tag& tag, bool stripSpaces) const; bool GetIntegerTag(int& result, const gdcm::Dict& dictionary, const gdcm::Tag& tag) const; Orthanc::Encoding GetEncoding() const; std::string GetWadoUrl(const OrthancPluginHttpRequest* request) const; }; void GenerateSingleDicomAnswer(std::string& result, const std::string& wadoBase, const gdcm::Dict& dictionary, const gdcm::File* file, // Can be NULL const gdcm::DataSet& dicom, bool isXml, bool isBulkAccessible); void AnswerDicom(OrthancPluginContext* context, OrthancPluginRestOutput* output, const std::string& wadoBase, const gdcm::Dict& dictionary, const gdcm::DataSet& dicom, bool isXml, bool isBulkAccessible); }