GDCM  2.2.3
gdcmBaseRootQuery.h
Go to the documentation of this file.
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 "gdcmDataSet.h"
00022 #include "gdcmUIDs.h"
00023 #include "gdcmObject.h"
00024 #include "gdcmQueryPatient.h"
00025 #include "gdcmQueryStudy.h"
00026 #include "gdcmQuerySeries.h"
00027 #include "gdcmQueryImage.h"
00028 
00029 namespace gdcm
00030 {
00031   class QueryFactory;
00032   class DictEntry;
00033 
00034   enum EQueryLevel
00035     {
00036     // -1 is reserved do not use
00037     ePatient = 0,
00038     eStudy   = 1,
00039     eSeries  = 2,
00040     eImage   = 3
00041     };
00042   enum EQueryType
00043     {
00044     eFind = 0,
00045     eMove
00046     };
00047 
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 protected:
00070   QueryPatient mPatient;
00071   QueryStudy mStudy;
00072   QuerySeries mSeries;
00073   QueryImage mImage;
00074 
00075   DataSet mDataSet;
00076   friend class QueryFactory;
00077   BaseRootQuery();
00078 
00079   ERootType mRootType; //set in construction, and it's something else in the study root type
00080   std::string mHelpDescription; //used when generating the help output
00081 
00082   void SetSearchParameter(const Tag& inTag, const DictEntry& inDictEntry, const std::string& inValue);
00083 public:
00084   virtual ~BaseRootQuery();
00085 
00086   void SetSearchParameter(const Tag& inTag, const std::string& inValue);
00087   void SetSearchParameter(const std::string& inKeyword, const std::string& inValue);
00088 
00089   const std::ostream &WriteHelpFile(std::ostream &os);
00090 
00091   //this function allows writing of the query to disk for storing for future use
00092   //virtual in case it needs to be overiden
00093   //returns false if the operation failed
00094   bool WriteQuery(const std::string& inFileName);
00095 
00097   DataSet const & GetQueryDataSet() const;
00098   DataSet & GetQueryDataSet();
00099   void AddQueryDataSet(const DataSet & ds);
00100 
00104   virtual std::vector<Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel) = 0;
00105 
00109   virtual void InitializeDataSet(const EQueryLevel& inQueryLevel) = 0;
00110 
00124   virtual bool ValidateQuery(bool inStrict = true) const = 0;
00125 
00126   virtual UIDs::TSName GetAbstractSyntaxUID() const = 0;
00127 
00128   void Print(std::ostream &os) const;
00129 
00130   static const char *GetQueryLevelString( EQueryLevel ql );
00131   static int GetQueryLevelFromString( const char * str );
00132 
00133   static QueryBase * Construct(ERootType inRootType, EQueryLevel qlevel);
00134   EQueryLevel GetQueryLevelFromQueryRoot( ERootType roottype );
00135 };
00136 
00137 } // end namespace gdcm
00138 
00139 #endif //GDCMBASEROOTQUERY_H

Generated on Thu Nov 28 2013 07:02:50 for GDCM by doxygen 1.7.6.1
SourceForge.net Logo