[Gdcm-hackers] gdcm-git:Grassroots DICOM branch master updated. b9151071cd2efdf9bb03344b832311cb43f
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: Mark R. <mm...@us...> - 2011-01-27 03:52:05
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Grassroots DICOM".
The branch, master has been updated
via b9151071cd2efdf9bb03344b832311cb43f2c038 (commit)
via 29fb5c1d42cc4417dabe0a05eea2ce4651280afa (commit)
from feab6aa2d61e53948954381d3510d0d751d7d7c6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=b9151071cd2efdf9bb03344b832311cb43f2c038
commit b9151071cd2efdf9bb03344b832311cb43f2c038
Author: Mark Roden <mm...@gm...>
Date: Wed Jan 26 19:51:44 2011 -0800
queries are now in the gdcm namespace, not network
diff --git a/Source/MessageExchangeDefinition/gdcmBaseRootQuery.cxx b/Source/MessageExchangeDefinition/gdcmBaseRootQuery.cxx
index f6eb9ed..a2e898d 100644
--- a/Source/MessageExchangeDefinition/gdcmBaseRootQuery.cxx
+++ b/Source/MessageExchangeDefinition/gdcmBaseRootQuery.cxx
@@ -45,7 +45,6 @@ The dataset held by this object (or, really, one of its derivates) should be pas
#include "gdcmWriter.h"
namespace gdcm{
-namespace network {
BaseRootQuery::BaseRootQuery(){
//nothing to do, really
@@ -230,4 +229,3 @@ void BaseRootQuery::InitializeDataSet(const EQueryLevel& inQueryLevel){
}
}
-}
diff --git a/Source/MessageExchangeDefinition/gdcmBaseRootQuery.h b/Source/MessageExchangeDefinition/gdcmBaseRootQuery.h
index e449483..408e9f3 100644
--- a/Source/MessageExchangeDefinition/gdcmBaseRootQuery.h
+++ b/Source/MessageExchangeDefinition/gdcmBaseRootQuery.h
@@ -28,7 +28,8 @@
#include <iostream>
namespace gdcm{
- namespace network {
+ class QueryFactory;
+
/**
* \brief BaseRootQuery
* contains: a baseclass which will produce a dataset for c-find and c-move with patient/study root
@@ -45,75 +46,73 @@ namespace gdcm{
*
* The dataset held by this object (or, really, one of its derivates) should be passed to a c-find or c-move query.
*/
- enum GDCM_EXPORT EQueryLevel {
- ePatient,
- eStudy,
- eSeries,
- eImageOrFrame
- };
-
- class QueryFactory;
-class GDCM_EXPORT BaseRootQuery
-{
- //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.
-
- DataSet mDataSet;
+ enum GDCM_EXPORT EQueryLevel {
+ ePatient,
+ eStudy,
+ eSeries,
+ eImageOrFrame
+ };
+
+ class GDCM_EXPORT BaseRootQuery
+ {
+ //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.
+
+ DataSet mDataSet;
protected:
- friend class QueryFactory;
- BaseRootQuery();
+ friend class QueryFactory;
+ BaseRootQuery();
- QueryPatient mPatient;
- QueryStudy mStudy;
- QuerySeries mSeries;
- QueryImage mImage;
+ 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
- virtual void SetParameters() = 0; //to ensure that this base class is not used directly,
- //a particular instance must be chosen
+ ERootType mRootType; //set in construction, and it's something else in the study root type
+ std::string mHelpDescription; //used when generating the help output
+ virtual void SetParameters() = 0; //to ensure that this base class is not used directly,
+ //a particular instance must be chosen
- void SetSearchParameter(const gdcm::Tag& inTag, const gdcm::DictEntry& inDictEntry, const std::string& inValue);
+ void SetSearchParameter(const gdcm::Tag& inTag, const gdcm::DictEntry& inDictEntry, const std::string& inValue);
public:
- virtual ~BaseRootQuery();
-
- void SetSearchParameter(const gdcm::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);
-
- DataSet const & GetQueryDataSet() const;
-
- ///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<gdcm::Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel, bool forFind) = 0;
-
- //this function sets tag 8,52 to the appropriate value based on query level
- void InitializeDataSet(const EQueryLevel& inQueryLevel);
-
- ///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 forFind, bool inStrict) const = 0;
- };
- }
+ virtual ~BaseRootQuery();
+
+ void SetSearchParameter(const gdcm::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);
+
+ DataSet const & GetQueryDataSet() const;
+
+ ///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<gdcm::Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel, bool forFind) = 0;
+
+ //this function sets tag 8,52 to the appropriate value based on query level
+ void InitializeDataSet(const EQueryLevel& inQueryLevel);
+
+ ///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 forFind, bool inStrict) const = 0;
+ };
}
diff --git a/Source/MessageExchangeDefinition/gdcmCompositeMessageFactory.h b/Source/MessageExchangeDefinition/gdcmCompositeMessageFactory.h
index 72ddfed..a416e2e 100644
--- a/Source/MessageExchangeDefinition/gdcmCompositeMessageFactory.h
+++ b/Source/MessageExchangeDefinition/gdcmCompositeMessageFactory.h
@@ -23,8 +23,8 @@
#include "gdcmULConnection.h"
namespace gdcm {
+ class BaseRootQuery;
namespace network {
- class BaseRootQuery;
class BasePDU;
/**
* \brief CompositeMessageFactory
diff --git a/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.cxx b/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.cxx
index 55f071b..180ed30 100644
--- a/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.cxx
+++ b/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.cxx
@@ -88,26 +88,26 @@ bool CompositeNetworkFunctions::CEcho( const char *remote, int portno, std::stri
//returns NULL if the query could not be constructed.
//note that the caller is responsible for deleting the constructed query.
//used to build both a move and a find query (true for inMove if it's move, false if it's find)
-gdcm::network::BaseRootQuery* CompositeNetworkFunctions::ConstructQuery(bool inMove, bool findstudy, bool findpatient,
+gdcm::BaseRootQuery* CompositeNetworkFunctions::ConstructQuery(bool inMove, bool findstudy, bool findpatient,
const std::vector< std::pair<gdcm::Tag, std::string> >& keys)
{
gdcm::StringFilter sf;
std::vector< std::pair<gdcm::Tag, std::string> >::const_iterator it =
keys.begin();
- gdcm::network::BaseRootQuery* outQuery = 0;
+ gdcm::BaseRootQuery* outQuery = 0;
if (findstudy)
{
//theQuery = new gdcm::network::StudyRootQuery();
outQuery =
- gdcm::network::QueryFactory::ProduceQuery(
- gdcm::network::eStudyRootType, gdcm::network::eStudy);
+ gdcm::QueryFactory::ProduceQuery(
+ gdcm::eStudyRootType, gdcm::eStudy);
}
else if (findpatient)
{
//theQuery = new gdcm::network::PatientRootQuery();
outQuery =
- gdcm::network::QueryFactory::ProduceQuery(
- gdcm::network::ePatientRootType, gdcm::network::ePatient);
+ gdcm::QueryFactory::ProduceQuery(
+ gdcm::ePatientRootType, gdcm::ePatient);
}
else
@@ -134,9 +134,9 @@ gdcm::network::BaseRootQuery* CompositeNetworkFunctions::ConstructQuery(bool inM
// setup the special character set
- std::vector<gdcm::network::ECharSet> inCharSetType;
- inCharSetType.push_back( gdcm::network::QueryFactory::GetCharacterFromCurrentLocale() );
- gdcm::DataElement de = gdcm::network::QueryFactory::ProduceCharacterSetDataElement(inCharSetType);
+ std::vector<gdcm::ECharSet> inCharSetType;
+ inCharSetType.push_back( gdcm::QueryFactory::GetCharacterFromCurrentLocale() );
+ gdcm::DataElement de = gdcm::QueryFactory::ProduceCharacterSetDataElement(inCharSetType);
std::string param ( de.GetByteValue()->GetPointer(),
de.GetByteValue()->GetLength() );
outQuery->SetSearchParameter(de.GetTag(), param );
@@ -147,7 +147,7 @@ gdcm::network::BaseRootQuery* CompositeNetworkFunctions::ConstructQuery(bool inM
//note that pointer to the base root query-- the caller must instantiated and delete
bool CompositeNetworkFunctions::CMove( const char *remote, int portno, std::string const &aetitle,
- std::string const &call, gdcm::network::BaseRootQuery* query,
+ std::string const &call, gdcm::BaseRootQuery* query,
int portscp, std::string const & outputdir)
{
// $ findscu -v -d --aetitle ACME1 --call ACME_STORE -P -k 0010,0010="X*" dhcp-67-183 5678 patqry.dcm
@@ -184,7 +184,7 @@ bool CompositeNetworkFunctions::CMove( const char *remote, int portno, std::stri
//note that pointer to the base root query-- the caller must instantiated and delete
std::vector<gdcm::DataSet> CompositeNetworkFunctions::CFind( const char *remote, int portno , std::string const &aetitle,
- std::string const &call , gdcm::network::BaseRootQuery* query )
+ std::string const &call , gdcm::BaseRootQuery* query )
{
// $ findscu -v -d --aetitle ACME1 --call ACME_STORE -P -k 0010,0010="X*" dhcp-67-183 5678 patqry.dcm
// Add a query:
diff --git a/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.h b/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.h
index 196fed7..71998a3 100644
--- a/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.h
+++ b/Source/MessageExchangeDefinition/gdcmCompositeNetworkFunctions.h
@@ -26,9 +26,7 @@
namespace gdcm{
class DataSet;
class Tag;
- namespace network{
- class BaseRootQuery;
- }
+ class BaseRootQuery;
/// These functions provide a generic API to the DICOM functions implemented in GDCM.
/// Advanced users can use this code as a template for building their own versions of
/// these functions (for instance, to provide progress bars or some other way of handling
@@ -53,8 +51,8 @@ namespace gdcm{
///Note that the caller is responsible for deleting the constructed query.
///This function is used to build both a move and a find query
///(true for inMove if it's move, false if it's find)
- gdcm::network::BaseRootQuery* ConstructQuery(bool inMove, bool findstudy, bool findpatient,
- const std::vector< std::pair<gdcm::Tag, std::string> >& keys);
+ gdcm::BaseRootQuery* ConstructQuery(bool inMove, bool findstudy, bool findpatient,
+ const std::vector< std::pair<gdcm::Tag, std::string> >& keys);
///This function will use the provided query to get files from a remote server.
@@ -67,7 +65,7 @@ namespace gdcm{
///should remain in memory, for instance, that behavior can be changed by creating a user-level version
///of this function.
bool CMove( const char *remote, int portno, std::string const &aetitle,
- const std::string& call, gdcm::network::BaseRootQuery* query,
+ const std::string& call, gdcm::BaseRootQuery* query,
int portscp, const std::string& outputdir);
@@ -76,7 +74,7 @@ namespace gdcm{
///by the server. If the dataset is empty, then it is possible that an error condition was encountered;
///in which case, the user should monitor the error and warning streams.
std::vector<gdcm::DataSet> CFind( const char *remote, int portno , std::string const &aetitle,
- std::string const &call , gdcm::network::BaseRootQuery* query );
+ std::string const &call , gdcm::BaseRootQuery* query );
///This function will place the provided files into the remote server.
///The function returns true if it worked.
diff --git a/Source/MessageExchangeDefinition/gdcmPDUFactory.cxx b/Source/MessageExchangeDefinition/gdcmPDUFactory.cxx
index 20c5474..e67ded7 100644
--- a/Source/MessageExchangeDefinition/gdcmPDUFactory.cxx
+++ b/Source/MessageExchangeDefinition/gdcmPDUFactory.cxx
@@ -139,7 +139,7 @@ std::vector<BasePDU*> PDUFactory::CreateCEchoPDU(){
return outVector;
}
-std::vector<BasePDU*> PDUFactory::CreateCMovePDU(const ULConnection& inConnection, BaseRootQuery* inRootQuery)
+std::vector<BasePDU*> PDUFactory::CreateCMovePDU(const ULConnection& inConnection, gdcm::BaseRootQuery* inRootQuery)
{
std::vector<PresentationDataValue> pdv =
CompositeMessageFactory::ConstructCMoveRQ(inConnection, inRootQuery );
@@ -179,7 +179,7 @@ std::vector<BasePDU*> PDUFactory::CreateCStoreRSPPDU(gdcm::DataSet* inDataSet, B
return outVector;
}
-std::vector<BasePDU*> PDUFactory::CreateCFindPDU(const ULConnection& inConnection, BaseRootQuery* inRootQuery){
+std::vector<BasePDU*> PDUFactory::CreateCFindPDU(const ULConnection& inConnection, gdcm::BaseRootQuery* inRootQuery){
//still have to build this!
std::vector<PresentationDataValue> pdv = CompositeMessageFactory::ConstructCFindRQ(inConnection, inRootQuery );
std::vector<PresentationDataValue>::iterator pdvItor;
diff --git a/Source/MessageExchangeDefinition/gdcmPDUFactory.h b/Source/MessageExchangeDefinition/gdcmPDUFactory.h
index 66f4ec4..abcc889 100644
--- a/Source/MessageExchangeDefinition/gdcmPDUFactory.h
+++ b/Source/MessageExchangeDefinition/gdcmPDUFactory.h
@@ -25,16 +25,16 @@
#include "gdcmPresentationDataValue.h"
namespace gdcm{
+ class BaseRootQuery;
namespace network{
class BasePDU;
- class BaseRootQuery;
/**
* \brief PDUFactory basically, given an initial byte, construct the
* appropriate PDU. This way, the event loop doesn't have to know about all
* the different PDU types.
*/
-class PDUFactory {
+ class PDUFactory {
public:
static BasePDU* ConstructPDU(uint8_t itemtype);//eventually needs to be smartpointer'd
static EEventID DetermineEventByPDU(BasePDU* inPDU);
diff --git a/Source/MessageExchangeDefinition/gdcmPatientRootQuery.cxx b/Source/MessageExchangeDefinition/gdcmPatientRootQuery.cxx
index 352f805..0dc8373 100644
--- a/Source/MessageExchangeDefinition/gdcmPatientRootQuery.cxx
+++ b/Source/MessageExchangeDefinition/gdcmPatientRootQuery.cxx
@@ -28,7 +28,6 @@ placeholder file to get the compiler/linker to play nice with this file
#include "gdcmAttribute.h"
namespace gdcm{
-namespace network {
PatientRootQuery::PatientRootQuery() {
SetParameters();
@@ -248,5 +247,5 @@ bool PatientRootQuery::ValidateQuery(bool forFind, bool inStrict) const{
return theReturn && (thePresentTagCount > 0);
}
-}
+
}
diff --git a/Source/MessageExchangeDefinition/gdcmPatientRootQuery.h b/Source/MessageExchangeDefinition/gdcmPatientRootQuery.h
index c61be5a..51f5cb4 100644
--- a/Source/MessageExchangeDefinition/gdcmPatientRootQuery.h
+++ b/Source/MessageExchangeDefinition/gdcmPatientRootQuery.h
@@ -21,24 +21,22 @@
#include "gdcmBaseRootQuery.h"
namespace gdcm{
- namespace network {
/**
* \brief PatientRootQuery
* contains: the class which will produce a dataset for c-find and c-move with patient root
*/
- class QueryFactory;
-class GDCM_EXPORT PatientRootQuery : public BaseRootQuery {
- private:
- void SetParameters();
- friend class QueryFactory;
- PatientRootQuery();
- public:
- ~PatientRootQuery();
+ class QueryFactory;
+ class GDCM_EXPORT PatientRootQuery : public BaseRootQuery {
+ private:
+ void SetParameters();
+ friend class QueryFactory;
+ PatientRootQuery();
+ public:
+ ~PatientRootQuery();
- std::vector<gdcm::Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel, bool forFind);
- bool ValidateQuery(bool forFind, bool inStrict) const;
- };
- }
+ std::vector<gdcm::Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel, bool forFind);
+ bool ValidateQuery(bool forFind, bool inStrict) const;
+ };
}
#endif //PATIENTROOTQUERY_H
diff --git a/Source/MessageExchangeDefinition/gdcmQueryBase.h b/Source/MessageExchangeDefinition/gdcmQueryBase.h
index 38c656c..73373fc 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryBase.h
+++ b/Source/MessageExchangeDefinition/gdcmQueryBase.h
@@ -26,11 +26,10 @@
#include <algorithm>
namespace gdcm{
- namespace network{
- enum GDCM_EXPORT ERootType{
- ePatientRootType,
- eStudyRootType
- };
+ enum GDCM_EXPORT ERootType{
+ ePatientRootType,
+ eStudyRootType
+ };
/**
* \brief QueryBase
@@ -59,26 +58,25 @@ namespace gdcm{
*/
class QueryBase
{
- public:
+ public:
- virtual std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const = 0;
- virtual std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const = 0;
- virtual std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const = 0;
- ///In order to validate a query dataset, just check for the presence of a tag,
- ///not it's requirement level in the spec
- virtual std::vector<gdcm::Tag> GetAllTags(const ERootType& inRootType) const{
- std::vector<gdcm::Tag> theReturn = GetRequiredTags(inRootType);
- std::vector<gdcm::Tag> theNext = GetUniqueTags(inRootType);
- theReturn.insert(theReturn.end(), theNext.begin(), theNext.end());
- theNext = GetOptionalTags(inRootType);
- theReturn.insert(theReturn.end(), theNext.begin(), theNext.end());
- return theReturn;
- }
+ virtual std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const = 0;
+ virtual std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const = 0;
+ virtual std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const = 0;
+ ///In order to validate a query dataset, just check for the presence of a tag,
+ ///not it's requirement level in the spec
+ virtual std::vector<gdcm::Tag> GetAllTags(const ERootType& inRootType) const{
+ std::vector<gdcm::Tag> theReturn = GetRequiredTags(inRootType);
+ std::vector<gdcm::Tag> theNext = GetUniqueTags(inRootType);
+ theReturn.insert(theReturn.end(), theNext.begin(), theNext.end());
+ theNext = GetOptionalTags(inRootType);
+ theReturn.insert(theReturn.end(), theNext.begin(), theNext.end());
+ return theReturn;
+ }
- virtual std::string GetName() const = 0;
- virtual DataElement GetQueryLevel() const = 0;
- };
- }
+ virtual std::string GetName() const = 0;
+ virtual DataElement GetQueryLevel() const = 0;
+ };
}
#endif //GDCMQUERYBASE_H
diff --git a/Source/MessageExchangeDefinition/gdcmQueryFactory.cxx b/Source/MessageExchangeDefinition/gdcmQueryFactory.cxx
index cd133b9..459c855 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryFactory.cxx
+++ b/Source/MessageExchangeDefinition/gdcmQueryFactory.cxx
@@ -22,7 +22,6 @@
#include <locale>
namespace gdcm{
- namespace network {
BaseRootQuery* QueryFactory::ProduceQuery(const ERootType &inRootType, const EQueryLevel& inQueryLevel){
BaseRootQuery* theReturn = NULL;
switch (inRootType){
@@ -181,5 +180,4 @@ void QueryFactory::ListCharSets(std::ostream& os){
}
- }
}
diff --git a/Source/MessageExchangeDefinition/gdcmQueryFactory.h b/Source/MessageExchangeDefinition/gdcmQueryFactory.h
index d61f581..7cb37aa 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryFactory.h
+++ b/Source/MessageExchangeDefinition/gdcmQueryFactory.h
@@ -21,28 +21,27 @@
#include "gdcmBaseRootQuery.h"
namespace gdcm{
- namespace network{
///The character sets enumerated in 9.3 Annex C, section C.12.1.1.2
///The resulting character set is stored in 0008,0005
///The conversion to the data element is performed by the QueryFactory itself
- enum GDCM_EXPORT ECharSet {
- eLatin1 = 0,
- eLatin2,
- eLatin3,
- eLatin4,
- eCyrillic,
- eArabic,
- eGreek,
- eHebrew,
- eLatin5,
- eJapanese,
- eThai,
- eJapaneseKanjiMultibyte,
- eJapaneseSupplementaryKanjiMultibyte,
- eKoreanHangulHanjaMultibyte,
- eUTF8,
- eGB18030
- };
+ enum GDCM_EXPORT ECharSet {
+ eLatin1 = 0,
+ eLatin2,
+ eLatin3,
+ eLatin4,
+ eCyrillic,
+ eArabic,
+ eGreek,
+ eHebrew,
+ eLatin5,
+ eJapanese,
+ eThai,
+ eJapaneseKanjiMultibyte,
+ eJapaneseSupplementaryKanjiMultibyte,
+ eKoreanHangulHanjaMultibyte,
+ eUTF8,
+ eGB18030
+ };
/**
* \brief QueryFactory.h
@@ -85,7 +84,6 @@ public:
static void ListCharSets(std::ostream& os);
};
-} // end namespace network
} // end namespace gdcm
#endif // GDCMQUERYFACTORY_H
diff --git a/Source/MessageExchangeDefinition/gdcmQueryImage.cxx b/Source/MessageExchangeDefinition/gdcmQueryImage.cxx
index 10a7da7..5db8bd5 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryImage.cxx
+++ b/Source/MessageExchangeDefinition/gdcmQueryImage.cxx
@@ -26,7 +26,6 @@ name and date: 15 oct 2010 mmr
#include "gdcmQueryImage.h"
namespace gdcm{
-namespace network{
std::vector<Tag> QueryImage::GetRequiredTags(const ERootType& inRootType) const{
std::vector<Tag> theReturn;//see 3.4 C.6.1.1.5
theReturn.push_back(Tag(0x0020, 0x0013));
@@ -61,4 +60,3 @@ DataElement QueryImage::GetQueryLevel() const{
}
}
-}
diff --git a/Source/MessageExchangeDefinition/gdcmQueryImage.h b/Source/MessageExchangeDefinition/gdcmQueryImage.h
index 2cadc60..65cd373 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryImage.h
+++ b/Source/MessageExchangeDefinition/gdcmQueryImage.h
@@ -22,22 +22,20 @@
#include "gdcmDataSet.h"
namespace gdcm{
- namespace network{
/**
* \brief QueryImage
* contains: class to construct an image-based query for c-find and c-move
*/
-class QueryImage : public QueryBase {
- gdcm::DataSet mCurrentQuery;
- public:
- std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const;
- std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const;
- std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const;
+ class QueryImage : public QueryBase {
+ gdcm::DataSet mCurrentQuery;
+ public:
+ std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const;
+ std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const;
+ std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const;
- std::string GetName() const { return "Composite Object Instance (Image)"; }
- DataElement GetQueryLevel() const;
- };
- }
+ std::string GetName() const { return "Composite Object Instance (Image)"; }
+ DataElement GetQueryLevel() const;
+ };
}
#endif // GDCMQUERYIMAGE_H
diff --git a/Source/MessageExchangeDefinition/gdcmQueryPatient.cxx b/Source/MessageExchangeDefinition/gdcmQueryPatient.cxx
index 1da8534..2ce805e 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryPatient.cxx
+++ b/Source/MessageExchangeDefinition/gdcmQueryPatient.cxx
@@ -26,7 +26,6 @@ name and date: 15 oct 2010 mmr
#include "gdcmQueryPatient.h"
namespace gdcm{
-namespace network{
std::vector<gdcm::Tag> QueryPatient::GetRequiredTags(const ERootType& inRootType) const{
std::vector<gdcm::Tag> theReturn;//see 3.4 C.6.1.1.2
@@ -88,4 +87,3 @@ DataElement QueryPatient::GetQueryLevel() const{
return de;
}
}
-}
diff --git a/Source/MessageExchangeDefinition/gdcmQueryPatient.h b/Source/MessageExchangeDefinition/gdcmQueryPatient.h
index fb17ed7..3bd0e67 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryPatient.h
+++ b/Source/MessageExchangeDefinition/gdcmQueryPatient.h
@@ -21,22 +21,20 @@
#include "gdcmQueryBase.h"
namespace gdcm{
- namespace network{
/**
* \brief QueryPatient
* contains: class to construct a patient-based query for c-find and c-move
* name and date: 15 oct 2010 mmr
*/
class QueryPatient : public QueryBase {
- public:
- std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const;
- std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const;
- std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const;
+ public:
+ std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const;
+ std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const;
+ std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const;
- std::string GetName() const { return "Patient"; }
- DataElement GetQueryLevel() const;
- };
- }
+ std::string GetName() const { return "Patient"; }
+ DataElement GetQueryLevel() const;
+ };
}
#endif //GDCMQUERYPATIENT_H
diff --git a/Source/MessageExchangeDefinition/gdcmQuerySeries.cxx b/Source/MessageExchangeDefinition/gdcmQuerySeries.cxx
index 203ff69..0fd4162 100644
--- a/Source/MessageExchangeDefinition/gdcmQuerySeries.cxx
+++ b/Source/MessageExchangeDefinition/gdcmQuerySeries.cxx
@@ -26,7 +26,7 @@ name and date: 15 oct 2010 mmr
#include "gdcmQuerySeries.h"
namespace gdcm{
-namespace network{
+
std::vector<gdcm::Tag> QuerySeries::GetRequiredTags(const ERootType& inRootType) const{
std::vector<gdcm::Tag> theReturn;//see 3.4 C.6.1.1.4
theReturn.push_back(Tag(0x0008, 0x0060));
@@ -53,5 +53,5 @@ DataElement QuerySeries::GetQueryLevel() const{
de.SetByteValue(theValue.c_str(), (uint32_t)theValue.length());
return de;
}
-}
+
}
diff --git a/Source/MessageExchangeDefinition/gdcmQuerySeries.h b/Source/MessageExchangeDefinition/gdcmQuerySeries.h
index 01e0523..4bdf2b7 100644
--- a/Source/MessageExchangeDefinition/gdcmQuerySeries.h
+++ b/Source/MessageExchangeDefinition/gdcmQuerySeries.h
@@ -21,22 +21,20 @@
#include "gdcmQueryBase.h"
namespace gdcm{
- namespace network{
/**
* \brief QuerySeries
* contains: class to construct a series-based query for c-find and c-move
* name and date: 15 oct 2010 mmr
*/
-class QuerySeries : public QueryBase {
- public:
- std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const;
- std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const;
- std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const;
+ class QuerySeries : public QueryBase {
+ public:
+ std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const;
+ std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const;
+ std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const;
- std::string GetName() const { return "Series"; }
- DataElement GetQueryLevel() const;
- };
- }
+ std::string GetName() const { return "Series"; }
+ DataElement GetQueryLevel() const;
+ };
}
#endif //GDCMQUERYSERIES_H
diff --git a/Source/MessageExchangeDefinition/gdcmQueryStudy.cxx b/Source/MessageExchangeDefinition/gdcmQueryStudy.cxx
index bf0bc64..faee530 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryStudy.cxx
+++ b/Source/MessageExchangeDefinition/gdcmQueryStudy.cxx
@@ -26,7 +26,7 @@ name and date: 15 oct 2010 mmr
#include "gdcmQueryStudy.h"
namespace gdcm{
-namespace network{
+
std::vector<Tag> QueryStudy::GetRequiredTags(const ERootType& inRootType) const{
std::vector<Tag> theReturn;//see 3.4 C.6.1.1.3
switch (inRootType){
@@ -118,5 +118,5 @@ DataElement QueryStudy::GetQueryLevel() const{
de.SetByteValue(theValue.c_str(), (uint32_t)theValue.length());
return de;
}
-}
+
}
diff --git a/Source/MessageExchangeDefinition/gdcmQueryStudy.h b/Source/MessageExchangeDefinition/gdcmQueryStudy.h
index 0505012..e807746 100644
--- a/Source/MessageExchangeDefinition/gdcmQueryStudy.h
+++ b/Source/MessageExchangeDefinition/gdcmQueryStudy.h
@@ -21,22 +21,20 @@
#include "gdcmQueryBase.h"
namespace gdcm{
- namespace network{
/**
* \brief QueryStudy.h
* contains: class to construct a study-based query for c-find and c-move
*/
-class QueryStudy : public QueryBase {
- public:
- std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const;
- std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const;
- std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const;
+ class QueryStudy : public QueryBase {
+ public:
+ std::vector<gdcm::Tag> GetRequiredTags(const ERootType& inRootType) const;
+ std::vector<gdcm::Tag> GetUniqueTags(const ERootType& inRootType) const;
+ std::vector<gdcm::Tag> GetOptionalTags(const ERootType& inRootType) const;
- std::string GetName() const { return "Study"; }
- DataElement GetQueryLevel() const;
- };
- }
+ std::string GetName() const { return "Study"; }
+ DataElement GetQueryLevel() const;
+ };
}
#endif //GDCMQUERYSTUDY_H
diff --git a/Source/MessageExchangeDefinition/gdcmStudyRootQuery.cxx b/Source/MessageExchangeDefinition/gdcmStudyRootQuery.cxx
index 734825c..109fb6f 100644
--- a/Source/MessageExchangeDefinition/gdcmStudyRootQuery.cxx
+++ b/Source/MessageExchangeDefinition/gdcmStudyRootQuery.cxx
@@ -30,7 +30,6 @@ placeholder file to get the compiler/linker to play nice with this file
#include "gdcmDataSet.h"
namespace gdcm{
-namespace network {
StudyRootQuery::StudyRootQuery() {
SetParameters();
@@ -216,4 +215,3 @@ bool StudyRootQuery::ValidateQuery(bool forFind, bool inStrict) const{
}
}
-}
diff --git a/Source/MessageExchangeDefinition/gdcmStudyRootQuery.h b/Source/MessageExchangeDefinition/gdcmStudyRootQuery.h
index 43c6467..78bf738 100644
--- a/Source/MessageExchangeDefinition/gdcmStudyRootQuery.h
+++ b/Source/MessageExchangeDefinition/gdcmStudyRootQuery.h
@@ -22,29 +22,27 @@
namespace gdcm{
- namespace network {
/**
* \brief StudyRootQuery
* contains: the class which will produce a dataset for c-find and c-move with study root
*/
- class QueryFactory;
-class GDCM_EXPORT StudyRootQuery : public BaseRootQuery {
- private:
- void SetParameters();
- friend class QueryFactory;
- StudyRootQuery();
- public:
- ~StudyRootQuery();
+ class QueryFactory;
+ class GDCM_EXPORT StudyRootQuery : public BaseRootQuery {
+ private:
+ void SetParameters();
+ friend class QueryFactory;
+ StudyRootQuery();
+ public:
+ ~StudyRootQuery();
- std::vector<gdcm::Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel, bool forFind);
+ std::vector<gdcm::Tag> GetTagListByLevel(const EQueryLevel& inQueryLevel, bool forFind);
- ///have to be able to ensure that
- ///0x8,0x52 is set
- ///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)
- bool ValidateQuery(bool forFind, bool inStrict) const;
- };
- }
+ ///have to be able to ensure that
+ ///0x8,0x52 is set
+ ///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)
+ bool ValidateQuery(bool forFind, bool inStrict) const;
+ };
}
diff --git a/Source/MessageExchangeDefinition/gdcmULConnectionManager.cxx b/Source/MessageExchangeDefinition/gdcmULConnectionManager.cxx
index bc6f2f1..f47245e 100644
--- a/Source/MessageExchangeDefinition/gdcmULConnectionManager.cxx
+++ b/Source/MessageExchangeDefinition/gdcmULConnectionManager.cxx
@@ -342,14 +342,14 @@ std::vector<PresentationDataValue> ULConnectionManager::SendEcho(){
}
}
-std::vector<gdcm::DataSet> ULConnectionManager::SendMove(BaseRootQuery* inRootQuery)
+std::vector<gdcm::DataSet> ULConnectionManager::SendMove(gdcm::BaseRootQuery* inRootQuery)
{
ULBasicCallback theCallback;
SendMove(inRootQuery, &theCallback);
return theCallback.GetDataSets();
}
-void ULConnectionManager::SendMove(BaseRootQuery* inRootQuery, ULConnectionCallback* inCallback){
+void ULConnectionManager::SendMove(gdcm::BaseRootQuery* inRootQuery, ULConnectionCallback* inCallback){
if (mConnection == NULL){
return;
}
@@ -358,14 +358,14 @@ void ULConnectionManager::SendMove(BaseRootQuery* inRootQuery, ULConnectionCallb
RunMoveEventLoop(theEvent, inCallback);
}
-std::vector<gdcm::DataSet> ULConnectionManager::SendFind(BaseRootQuery* inRootQuery)
+std::vector<gdcm::DataSet> ULConnectionManager::SendFind(gdcm::BaseRootQuery* inRootQuery)
{
ULBasicCallback theCallback;
SendFind(inRootQuery, &theCallback);
return theCallback.GetDataSets();
}
-void ULConnectionManager::SendFind(BaseRootQuery* inRootQuery, ULConnectionCallback* inCallback){
+void ULConnectionManager::SendFind(gdcm::BaseRootQuery* inRootQuery, ULConnectionCallback* inCallback){
if (mConnection == NULL){
return;
}
diff --git a/Source/MessageExchangeDefinition/gdcmULConnectionManager.h b/Source/MessageExchangeDefinition/gdcmULConnectionManager.h
index d3f146f..96ea3fa 100644
--- a/Source/MessageExchangeDefinition/gdcmULConnectionManager.h
+++ b/Source/MessageExchangeDefinition/gdcmULConnectionManager.h
@@ -26,10 +26,9 @@
namespace gdcm {
class DataSet;
-
+ class BaseRootQuery;
namespace network {
- class BaseRootQuery;
enum GDCM_EXPORT EConnectionType {
eEcho,
eFind,
@@ -47,8 +46,8 @@ namespace gdcm {
*
* Its inputs are ULEvents, and it performs ULActions.
*/
-class GDCM_EXPORT ULConnectionManager
-{
+ class GDCM_EXPORT ULConnectionManager
+ {
private:
ULConnection* mConnection;
ULConnection* mSecondaryConnection;
diff --git a/Testing/Source/MessageExchangeDefinition/Cxx/TestAllFunctions.cxx b/Testing/Source/MessageExchangeDefinition/Cxx/TestAllFunctions.cxx
index 1ee7fe8..479baf9 100644
--- a/Testing/Source/MessageExchangeDefinition/Cxx/TestAllFunctions.cxx
+++ b/Testing/Source/MessageExchangeDefinition/Cxx/TestAllFunctions.cxx
@@ -17,6 +17,7 @@
*=========================================================================*/
#include "gdcmCompositeNetworkFunctions.h"
+#include "gdcmBaseRootQuery.h"
#include "gdcmDirectory.h"
#include "gdcmTesting.h"
@@ -157,7 +158,7 @@ int TestAllFunctions(int argc, char *argv[])
keys.push_back(std::make_pair(theIDTag, theEmptyString));
- gdcm::network::BaseRootQuery *theQuery =
+ gdcm::BaseRootQuery *theQuery =
theNetworkFunctions.ConstructQuery(false, false, true, keys);
diff --git a/Testing/Source/MessageExchangeDefinition/Cxx/TestFind.cxx b/Testing/Source/MessageExchangeDefinition/Cxx/TestFind.cxx
index 5aa98af..780cf9c 100644
--- a/Testing/Source/MessageExchangeDefinition/Cxx/TestFind.cxx
+++ b/Testing/Source/MessageExchangeDefinition/Cxx/TestFind.cxx
@@ -39,7 +39,7 @@ int TestFind(int argc, char *argv[])
std::vector<std::pair<gdcm::Tag, std::string> > theTags;
theTags.push_back(theTagPair);
- gdcm::network::BaseRootQuery* theQuery = theNetworkFunctions.ConstructQuery(false, false, true, theTags);
+ gdcm::BaseRootQuery* theQuery = theNetworkFunctions.ConstructQuery(false, false, true, theTags);
if (!theQuery) {
std::cerr << "Query construction failed!" << std::endl;
diff --git a/Testing/Source/MessageExchangeDefinition/Cxx/TestQueryFactory.cxx b/Testing/Source/MessageExchangeDefinition/Cxx/TestQueryFactory.cxx
index 59fbe03..07480d7 100644
--- a/Testing/Source/MessageExchangeDefinition/Cxx/TestQueryFactory.cxx
+++ b/Testing/Source/MessageExchangeDefinition/Cxx/TestQueryFactory.cxx
@@ -19,6 +19,6 @@
int TestQueryFactory(int argc, char *argv[])
{
- gdcm::network::QueryFactory o;
+ gdcm::QueryFactory o;
return 0;
}
diff --git a/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx b/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
index b56a124..6dd0222 100644
--- a/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
+++ b/Testing/Source/MessageExchangeDefinition/Cxx/TestSCUValidation.cxx
@@ -36,7 +36,7 @@ gdcm::network::ULConnectionManager *GetConnectionManager()
{
gdcm::network::ULConnectionManager *theManager =
new gdcm::network::ULConnectionManager();
- gdcm::network::BaseRootQuery* theQuery;
+ gdcm::BaseRootQuery* theQuery;
//!!! Mathieu, this code will crash because theQuery is not initialized
if (!theManager->EstablishConnection(AETitle, PeerAETitle, ComputerName, 0,
port, 1000, gdcm::network::eFind, theQuery->GetQueryDataSet()))
@@ -50,9 +50,9 @@ std::vector<gdcm::DataSet> GetPatientInfo(bool validateQuery, bool inStrictQuery
{
std::vector<gdcm::DataSet> theDataSets;
gdcm::network::ULConnectionManager *theManager = GetConnectionManager();
- gdcm::network::BaseRootQuery* theQuery =
- gdcm::network::QueryFactory::ProduceQuery(gdcm::network::ePatientRootType,
- gdcm::network::ePatient);
+ gdcm::BaseRootQuery* theQuery =
+ gdcm::QueryFactory::ProduceQuery(gdcm::ePatientRootType,
+ gdcm::ePatient);
theQuery->SetSearchParameter(gdcm::Tag(0x8, 0x52), "PATIENT"); //Query/Retrieval Level
theQuery->SetSearchParameter(gdcm::Tag(0x10,0x20), ""); //Patient ID
theQuery->SetSearchParameter(gdcm::Tag(0x10,0x10), "*"); //Patient Name
@@ -68,8 +68,8 @@ std::vector<gdcm::DataSet> GetStudyInfo(const char *patientID, bool validateQuer
{
std::vector<gdcm::DataSet> theDataSets;
gdcm::network::ULConnectionManager *theManager = GetConnectionManager();
- gdcm::network::BaseRootQuery* theQuery =
- gdcm::network::QueryFactory::ProduceQuery(gdcm::network::eStudyRootType, gdcm::network::eStudy);
+ gdcm::BaseRootQuery* theQuery =
+ gdcm::QueryFactory::ProduceQuery(gdcm::eStudyRootType, gdcm::eStudy);
theQuery->SetSearchParameter(gdcm::Tag(0x8, 0x52), "STUDY"); //Query/Retrieval Level
theQuery->SetSearchParameter(gdcm::Tag(0x10,0x20), patientID); //Patient ID
@@ -88,8 +88,8 @@ std::vector<gdcm::DataSet> GetSeriesInfo(const char *patientID, const char *stud
{
std::vector<gdcm::DataSet> theDataSets;
gdcm::network::ULConnectionManager *theManager = GetConnectionManager();
- gdcm::network::BaseRootQuery* theQuery =
- gdcm::network::QueryFactory::ProduceQuery(gdcm::network::eStudyRootType, gdcm::network::eSeries);
+ gdcm::BaseRootQuery* theQuery =
+ gdcm::QueryFactory::ProduceQuery(gdcm::eStudyRootType, gdcm::eSeries);
theQuery->SetSearchParameter(gdcm::Tag(0x8, 0x52), "SERIES"); //Query/Retrieval Level
theQuery->SetSearchParameter(gdcm::Tag(0x10,0x20), patientID); //Patient ID
@@ -108,8 +108,8 @@ std::vector<gdcm::DataSet> GetImageInfo(const char *patientID,
{
std::vector<gdcm::DataSet> theDataSets;
gdcm::network::ULConnectionManager *theManager = GetConnectionManager();
- gdcm::network::BaseRootQuery* theQuery =
- gdcm::network::QueryFactory::ProduceQuery(gdcm::network::eStudyRootType, gdcm::network::eImageOrFrame);
+ gdcm::BaseRootQuery* theQuery =
+ gdcm::QueryFactory::ProduceQuery(gdcm::eStudyRootType, gdcm::eImageOrFrame);
theQuery->SetSearchParameter(gdcm::Tag(0x8, 0x52), "SERIES"); //Query/Retrieval Level
theQuery->SetSearchParameter(gdcm::Tag(0x10,0x20), patientID); //Patient ID
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=commit;h=29fb5c1d42cc4417dabe0a05eea2ce4651280afa
commit 29fb5c1d42cc4417dabe0a05eea2ce4651280afa
Author: Mark Roden <mm...@gm...>
Date: Wed Jan 26 16:24:53 2011 -0800
updated the TestAllFunctions to use the new API
diff --git a/Testing/Source/MessageExchangeDefinition/Cxx/TestAllFunctions.cxx b/Testing/Source/MessageExchangeDefinition/Cxx/TestAllFunctions.cxx
index 6524c39..1ee7fe8 100644
--- a/Testing/Source/MessageExchangeDefinition/Cxx/TestAllFunctions.cxx
+++ b/Testing/Source/MessageExchangeDefinition/Cxx/TestAllFunctions.cxx
@@ -15,10 +15,8 @@
* limitations under the License.
*
*=========================================================================*/
-#include "gdcmStudyRootQuery.h"
-#include "gdcmULConnectionManager.h"
-#include "gdcmPatientRootQuery.h"
-#include "gdcmQueryFactory.h"
+
+#include "gdcmCompositeNetworkFunctions.h"
#include "gdcmDirectory.h"
#include "gdcmTesting.h"
@@ -27,6 +25,9 @@
#include "gdcmAttribute.h"
#include "gdcmGlobal.h"
+#include <iostream>
+#include <fstream>
+
//this should maybe override == ?
bool AreDataSetsEqual(const gdcm::DataSet& ds1, const gdcm::DataSet& ds2){
gdcm::DataSet::ConstIterator it1 = ds1.Begin();
@@ -68,7 +69,7 @@ int TestAllFunctions(int argc, char *argv[])
int portno = 11112;//the port of the server
int moveReturnPort = 11111;//the port over which return cstore scps are done for cmove
std::string remote("192.168.1.9");//the ip address of the remote server
- std::string outputDir("h:/gdcmtestdataretrievedcmtk");//place to where data is returned by cmove
+ std::string outputDir("h:/gdcmtestdataretrievedcmtkoutput");//place to where data is returned by cmove
std::string inputDir("h:/gdcmtestdataretrievedcmtk");//input collection of data to transfer
#else
if( argc < 6 )
@@ -85,22 +86,16 @@ int TestAllFunctions(int argc, char *argv[])
std::string outputDir = tmpdir; // ("h:/gdcmtestdataretrievedcmtk");//place to where data is returned by cmove
std::string inputDir = tmpdir; //("h:/gdcmtestdataretrievedcmtk");//input collection of data to transfer
-#endif
- gdcm::network::ERootType queryRootType = gdcm::network::ePatientRootType;//how queries are done
+#endif
+
+ gdcm::CompositeNetworkFunctions theNetworkFunctions;
+ bool didItWork = theNetworkFunctions.CEcho( remote.c_str(), portno, aetitle, call );
- //first, run an echo, make sure that that works.
- gdcm::network::ULConnectionManager theManager;
- gdcm::DataSet blank;
- if (!theManager.EstablishConnection(aetitle, call, remote, 0, portno, 10, gdcm::network::eEcho, blank)){
- std::cerr << "Failed to establish connection." << std::endl;
+ if (!didItWork)
+ {
+ std::cerr << "Echo failed." << std::endl;
return 1;
- }
- std::vector<gdcm::network::PresentationDataValue> theValues1 = theManager.SendEcho();
- std::vector<gdcm::network::PresentationDataValue>::iterator itor;
- for (itor = theValues1.begin(); itor < theValues1.end(); itor++){
- itor->Print(std::cout);
- }
- theManager.BreakConnection(-1);//wait for a while for the connection to break, ie, infinite
+ }
//now, run the individual tests.
//get the filenames from the test directory
@@ -108,112 +103,122 @@ int TestAllFunctions(int argc, char *argv[])
theDir.Load(inputDir, false);
std::vector<std::string> theFilenames = theDir.GetFilenames();
+ //store the datasets remotely
+ didItWork = theNetworkFunctions.CStore(remote.c_str(), portno, aetitle, call, theFilenames, false);
- //contrary to the warning, the factory is actually used.
- gdcm::network::QueryFactory theFactory;
+ if (!didItWork)
+ {
+ std::cerr << "Store failed." << std::endl;
+ return 1;
+ }
std::vector<std::string>::iterator fitor;
- for (fitor = theFilenames.begin(); fitor < theFilenames.end(); ++fitor){
+ for (fitor = theFilenames.begin(); fitor < theFilenames.end(); ++fitor)
+ {
//read in the file
gdcm::Reader theReader;
theReader.SetFileName(fitor->c_str());
if (!theReader.Read()) {
- std::cerr << "Test failed, dicom file failed to load." <<std::endl;
- continue;
+ std::cerr << "Test failed, dicom file " << *fitor << " failed to load." <<std::endl;
+ return 1;
}
gdcm::File theFile = theReader.GetFile();
gdcm::DataSet ds = theFile.GetDataSet();
- //store the file remotely
- if (!theManager.EstablishConnection(aetitle, call, remote, 0, portno, 10, gdcm::network::eStore, ds)){
- std::cerr << "Failed to establish c-store connection." << std::endl;
- continue;
- }
-
- std::vector<gdcm::DataSet> theReturn = theManager.SendStore(&ds);
- theManager.BreakConnection(-1);
-
- //construct the cfind query
- gdcm::network::BaseRootQuery* theQuery =
- theFactory.ProduceQuery(queryRootType, gdcm::network::eSeries);
-
- //take one of the required tags from the dataset
- //search the tags in the returned list for one that's in the dataset
- //whichever one's hit first, we'll search on, using the first char value followed by *
- std::vector<gdcm::Tag> theTags = theQuery->GetTagListByLevel(gdcm::network::eSeries, true);
-
- gdcm::Tag selectedTag;
- std::vector<gdcm::Tag>::iterator tagItor;
- for (tagItor = theTags.begin(); tagItor < theTags.end(); tagItor++){
- if (ds.FindDataElement(*tagItor)){
- gdcm::DataElement de = ds.GetDataElement(*tagItor);
- gdcm::ByteValue* theVal = de.GetByteValue();
- unsigned long len = 1;
- char* buf = new char[len];
- if (theVal->GetBuffer(buf, len)){
- std::string searchTerm(buf, &(buf[len]));//because buf is probably not null terminated
- searchTerm += "*";
- theQuery->SetSearchParameter(*tagItor, searchTerm);//searchTerm);
+ //have to construct a query from the dataset.
+ //grab tag 10,10, use that to get 10,20
+ //set the query just to be the first character and * after that.
+ std::vector<std::pair<gdcm::Tag, std::string> > keys;
+ gdcm::Tag theTag(0x0010, 0x0010);
+ gdcm::Tag theIDTag(0x0010, 0x0020);
+ if (ds.FindDataElement(theTag))
+ {
+ gdcm::DataElement de = ds.GetDataElement(theTag);
+ const gdcm::ByteValue* bv = de.GetByteValue();
+ int theBufferLen = bv->GetLength();
+ if (theBufferLen < 2) continue;
+ char* theBuf = new char[theBufferLen];
+ bv->GetBuffer(theBuf, theBufferLen);
+ std::string theSearchString(theBuf, theBuf + theBufferLen/2);
+ delete [] theBuf;
+ theSearchString += "*";
+ if (theSearchString.size() %2 == 1)
+ {
+ theSearchString += " "; //to make sure everything is double spaced
}
- delete [] buf;
- } else {
- theQuery->SetSearchParameter(*tagItor, "");//null string
- //check out
- //http://groups.google.com/group/comp.protocols.dicom/browse_thread/thread/a15957b33b23c1ee/1373e5e0241bd94b?lnk=gst&q=UID+root&pli=1
+ keys.push_back(std::make_pair(theTag, theSearchString));
}
- }
- //using the non-strict version of query validation
- if (!theQuery->ValidateQuery(true, false)){
- std::cerr << "Unable to validate query." << std::endl;
- delete theQuery;
- continue;
- }
- if (!theManager.EstablishConnection(aetitle, call, remote, 0, portno, 10,
- gdcm::network::eFind, theQuery->GetQueryDataSet())){
- std::cerr << "Failed to establish c-find connection." << std::endl;
- delete theQuery;
+ else
+ {
continue;
- }
+ }
+ std::string theEmptyString;
+ keys.push_back(std::make_pair(theIDTag, theEmptyString));
- std::vector<gdcm::DataSet> theQueryReturn = theManager.SendFind(theQuery);
- theManager.BreakConnection(-1);
+
+ gdcm::network::BaseRootQuery *theQuery =
+ theNetworkFunctions.ConstructQuery(false, false, true, keys);
- //now, find the dataset in theQueryReturn that corresponds to ds and then move it locally with a cmove
- //we will actually just do an in-memory comparison of the returned result.
- //for now, assume only one response.
- if (theQueryReturn.empty()){
- std::cerr << "Failed to find sent dataset." <<std::endl;
- delete theQuery;
- continue;
- }
- std::vector<gdcm::DataSet>::iterator theQueryResultItor;
- bool foundMatch = false;
-/* for (theQueryResultItor = theQueryReturn.begin(); theQueryResultItor < theQueryReturn.end(); theQueryResultItor++){
- //check to see if any data sets match upon return.
- theManager.EstablishConnectionMove(aetitle, call, remote, 0, portno, 10, moveReturnPort, *theQueryResultItor);
- std::vector<gdcm::DataSet> theMoveResult = theManager.SendMove(&(*theQueryResultItor));
- theManager.BreakConnection(-1);
- std::vector<gdcm::DataSet>::iterator theMoveResultItor;
- for (theMoveResultItor = theMoveResult.begin(); theMoveResultItor < theMoveResult.end(); ++theMoveResultItor){
- //now iterate over each data element
-
- if (AreDataSetsEqual(*theMoveResultItor, ds)){
- foundMatch = true;//can break now
- theQueryResultItor = theQueryReturn.end();
- theMoveResultItor = theMoveResult.end();
- break;
- }
+ std::vector<gdcm::DataSet> theDataSets =
+ theNetworkFunctions.CFind(remote.c_str(), portno, aetitle, call, theQuery);
+
+ delete theQuery;
+
+ if (theDataSets.empty())
+ {
+ std::cerr << "Unable to find the dataset that was just sent to the server, " << *fitor << std::endl;
+ return 1;
}
- }*/
- if (!foundMatch){
- std::cerr << "No found dataset matches stored dataset." <<std::endl;
- delete theQuery;
- continue;
+
+ keys.clear();
+ //if it's not empty, then pull it.
+ for (std::vector<gdcm::DataSet>::iterator itor = theDataSets.begin();
+ itor != theDataSets.end(); itor++)
+ {
+ if (itor->FindDataElement(theIDTag))
+ {
+ gdcm::DataElement de = itor->GetDataElement(theIDTag);
+ const gdcm::ByteValue *bv = de.GetByteValue();
+ int theBufferLen = bv->GetLength();
+ char* theBuf = new char[theBufferLen];
+ bv->GetBuffer(theBuf, theBufferLen);
+ std::string theSearchString(theBuf, theBuf + theBufferLen);
+ delete [] theBuf;
+ keys.push_back(std::make_pair(theIDTag, theSearchString));
+
+ gdcm::DataElement de2 = ds.GetDataElement(theIDTag);
+ if (!(de == de2))
+ {
+ std::cerr << "Sent dataset does not match returned dataset ID. " << std::endl;
+ return 1;
+ }
+ break;
+ }
+ else
+ {
+ continue;
+ }
}
+
+ if (keys.empty())
+ {
+ std::cerr << "Sent dataset " << *fitor << " was not found by resulting CFind query. " << std::endl;
+ return 1;
+ }
+
+ theQuery = theNetworkFunctions.ConstructQuery(true, false, true, keys);
+ didItWork = theNetworkFunctions.CMove(remote.c_str(), portno, aetitle, call, theQuery, moveReturnPort, outputDir);
+ if (!didItWork)
+ {
+ std::cerr << "CMove failed for file " << *fitor << std::endl;
+ return 1;
+ }
delete theQuery;
- std::cout << fitor->c_str() << " passed scu testing." <<std::endl;
+
+ std::cout << "File " << *fitor << " moved back to server." << std::endl;
+
}
return 0;
diff --git a/Testing/Source/MessageExchangeDefinition/Cxx/TestEcho.cxx b/Testing/Source/MessageExchangeDefinition/Cxx/TestEcho.cxx
index 74ea29c..8f1a7d5 100644
--- a/Testing/Source/MessageExchangeDefinition/Cxx/TestEcho.cxx
+++ b/Testing/Source/MessageExchangeDefinition/Cxx/TestEcho.cxx
@@ -17,7 +17,8 @@
*=========================================================================*/
#include "gdcmCompositeNetworkFunctions.h"
-
+#include "gdcmTag.h"
+#include "gdcmQueryFactory.h"
int TestEcho(int argc, char *argv[])
{
-----------------------------------------------------------------------
Summary of changes:
.../gdcmBaseRootQuery.cxx | 2 -
.../MessageExchangeDefinition/gdcmBaseRootQuery.h | 127 ++++++------
.../gdcmCompositeMessageFactory.h | 2 +-
.../gdcmCompositeNetworkFunctions.cxx | 22 +-
.../gdcmCompositeNetworkFunctions.h | 12 +-
.../MessageExchangeDefinition/gdcmPDUFactory.cxx | 4 +-
Source/MessageExchangeDefinition/gdcmPDUFactory.h | 4 +-
.../gdcmPatientRootQuery.cxx | 3 +-
.../gdcmPatientRootQuery.h | 24 +--
Source/MessageExchangeDefinition/gdcmQueryBase.h | 44 ++--
.../MessageExchangeDefinition/gdcmQueryFactory.cxx | 2 -
.../MessageExchangeDefinition/gdcmQueryFactory.h | 38 ++--
.../MessageExchangeDefinition/gdcmQueryImage.cxx | 2 -
Source/MessageExchangeDefinition/gdcmQueryImage.h | 20 +-
.../MessageExchangeDefinition/gdcmQueryPatient.cxx | 2 -
.../MessageExchangeDefinition/gdcmQueryPatient.h | 16 +-
.../MessageExchangeDefinition/gdcmQuerySeries.cxx | 4 +-
Source/MessageExchangeDefinition/gdcmQuerySeries.h | 18 +-
.../MessageExchangeDefinition/gdcmQueryStudy.cxx | 4 +-
Source/MessageExchangeDefinition/gdcmQueryStudy.h | 18 +-
.../gdcmStudyRootQuery.cxx | 2 -
.../MessageExchangeDefinition/gdcmStudyRootQuery.h | 32 ++--
.../gdcmULConnectionManager.cxx | 8 +-
.../gdcmULConnectionManager.h | 7 +-
.../Cxx/TestAllFunctions.cxx | 214 ++++++++++----------
.../MessageExchangeDefinition/Cxx/TestEcho.cxx | 3 +-
.../MessageExchangeDefinition/Cxx/TestFind.cxx | 2 +-
.../Cxx/TestQueryFactory.cxx | 2 +-
.../Cxx/TestSCUValidation.cxx | 20 +-
29 files changed, 317 insertions(+), 341 deletions(-)
hooks/post-receive
--
Grassroots DICOM
|