File: gdcmBaseRootQuery.h

package info (click to toggle)
gdcm 2.2.0-14.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 31,828 kB
  • sloc: cpp: 159,587; ansic: 124,519; xml: 44,180; sh: 7,019; python: 3,618; cs: 1,297; lex: 1,290; java: 1,242; tcl: 677; php: 111; makefile: 108
file content (133 lines) | stat: -rw-r--r-- 5,083 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*=========================================================================
 *
 *  Copyright Insight Software Consortium
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/
#ifndef GDCMBASEROOTQUERY_H
#define GDCMBASEROOTQUERY_H

#include "gdcmQueryPatient.h"
#include "gdcmQueryStudy.h"
#include "gdcmQuerySeries.h"
#include "gdcmQueryImage.h"
#include "gdcmDataSet.h"
#include "gdcmDictEntry.h"
#include "gdcmTag.h"
#include "gdcmUIDs.h"
#include "gdcmObject.h"

#include <iostream>

namespace gdcm{
  class QueryFactory;

/**
 * \brief BaseRootQuery
 * contains: a baseclass which will produce a dataset for c-find and c-move with patient/study root
 * name and date: 18 oct 2010 mmr
 *
 * This class contains the functionality used in patient c-find and c-move queries.
 * PatientRootQuery and StudyRootQuery derive from this class.
 *
 * Namely:
 * 1) list all tags associated with a particular query type
 * 2) produce a query dataset via tag association
 *
 * Eventually, it can be used to validate a particular dataset type.
 *
 * The dataset held by this object (or, really, one of its derivates) should be passed to a c-find or c-move query.
 */
  enum EQueryLevel
    {
    ePatient,
    eStudy,
    eSeries,
    eImageOrFrame
    };
  enum EQueryType
    {
    eFind,
    eMove
    };

  class GDCM_EXPORT BaseRootQuery : public Object
  {
    //these four classes contain the required, unique, and optional tags from the standard.
    //used both to list the tags as well as to validate a dataset, if ever we were to do so.

    protected:
    
    DataSet mDataSet;
    friend class QueryFactory;
    BaseRootQuery();

    QueryPatient mPatient;
    QueryStudy mStudy;
    QuerySeries mSeries;
    QueryImage mImage;

    ERootType mRootType; //set in construction, and it's something else in the study root type
    std::string mHelpDescription; //used when generating the help output

    void SetSearchParameter(const Tag& inTag, const DictEntry& inDictEntry, const std::string& inValue);
    public:
    virtual ~BaseRootQuery();

    void SetSearchParameter(const Tag& inTag, const std::string& inValue);
    void SetSearchParameter(const std::string& inKeyword, const std::string& inValue);

    virtual const std::ostream &WriteHelpFile(std::ostream &os);

    //this function allows writing of the query to disk for storing for future use
    //virtual in case it needs to be overiden
    //returns false if the operation failed
    virtual bool WriteQuery(const std::string& inFileName);

    /// Set/Get the internal representation of the query as a DataSet
    DataSet const & GetQueryDataSet() const;
    DataSet & GetQueryDataSet();
    void AddQueryDataSet(const DataSet & ds);

    ///this function will return all tags at a given query level, so that
    ///they maybe selected for searching.  The boolean forFind is true
    ///if the query is a find query, or false for a move query.
    virtual std::vector<Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel) = 0;

    /// this function sets tag 8,52 to the appropriate value based on query level
    /// also fills in the right unique tags, as per the standard's requirements
    /// should allow for connection with dcmtk 
    virtual void InitializeDataSet(const EQueryLevel& inQueryLevel) = 0;

    ///have to be able to ensure that
    ///0x8,0x52 is set (which will be true if InitializeDataSet is called...)
    ///that the level is appropriate (ie, not setting PATIENT for a study query
    ///that the tags in the query match the right level (either required, unique, optional)
    ///by default, this function checks to see if the query is for finding, which is more
    ///permissive than for moving.  For moving, only the unique tags are allowed.
    ///10 Jan 2011: adding in the 'strict' mode.
    ///according to the standard (at least, how I've read it), only tags for a particular
    ///level should be allowed in a particular query (ie, just series level tags in a series
    ///level query).  However, it seems that dcm4chee doesn't share that interpretation.
    ///So, if 'inStrict' is false, then tags from the current level and all higher levels
    ///are now considered valid.  So, if you're doing a non-strict series-level query,
    ///tags from the patient and study level can be passed along as well.
    virtual bool ValidateQuery(bool inStrict = true) const = 0;

    virtual UIDs::TSName GetAbstractSyntaxUID() const = 0;
  };
}


#endif //GDCMBASEROOTQUERY_H