GDCM
2.2.0
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef GDCMBASEROOTQUERY_H 00019 #define GDCMBASEROOTQUERY_H 00020 00021 #include "gdcmQueryPatient.h" 00022 #include "gdcmQueryStudy.h" 00023 #include "gdcmQuerySeries.h" 00024 #include "gdcmQueryImage.h" 00025 #include "gdcmDataSet.h" 00026 #include "gdcmDictEntry.h" 00027 #include "gdcmTag.h" 00028 #include "gdcmUIDs.h" 00029 #include "gdcmObject.h" 00030 00031 #include <iostream> 00032 00033 namespace gdcm{ 00034 class QueryFactory; 00035 00052 enum EQueryLevel 00053 { 00054 ePatient, 00055 eStudy, 00056 eSeries, 00057 eImageOrFrame 00058 }; 00059 enum EQueryType 00060 { 00061 eFind, 00062 eMove 00063 }; 00064 00065 class GDCM_EXPORT BaseRootQuery : public Object 00066 { 00067 //these four classes contain the required, unique, and optional tags from the standard. 00068 //used both to list the tags as well as to validate a dataset, if ever we were to do so. 00069 00070 protected: 00071 00072 DataSet mDataSet; 00073 friend class QueryFactory; 00074 BaseRootQuery(); 00075 00076 QueryPatient mPatient; 00077 QueryStudy mStudy; 00078 QuerySeries mSeries; 00079 QueryImage mImage; 00080 00081 ERootType mRootType; //set in construction, and it's something else in the study root type 00082 std::string mHelpDescription; //used when generating the help output 00083 00084 void SetSearchParameter(const Tag& inTag, const DictEntry& inDictEntry, const std::string& inValue); 00085 public: 00086 virtual ~BaseRootQuery(); 00087 00088 void SetSearchParameter(const Tag& inTag, const std::string& inValue); 00089 void SetSearchParameter(const std::string& inKeyword, const std::string& inValue); 00090 00091 virtual const std::ostream &WriteHelpFile(std::ostream &os); 00092 00093 //this function allows writing of the query to disk for storing for future use 00094 //virtual in case it needs to be overiden 00095 //returns false if the operation failed 00096 virtual bool WriteQuery(const std::string& inFileName); 00097 00099 DataSet const & GetQueryDataSet() const; 00100 DataSet & GetQueryDataSet(); 00101 void AddQueryDataSet(const DataSet & ds); 00102 00106 virtual std::vector<Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel) = 0; 00107 00111 virtual void InitializeDataSet(const EQueryLevel& inQueryLevel) = 0; 00112 00126 virtual bool ValidateQuery(bool inStrict = true) const = 0; 00127 00128 virtual UIDs::TSName GetAbstractSyntaxUID() const = 0; 00129 }; 00130 } 00131 00132 00133 #endif //GDCMBASEROOTQUERY_H