7 #include "fwActivities/validator/RelatedStudy.hpp" 9 #include "fwActivities/validator/registry/macros.hpp" 11 #include <fwData/Vector.hpp> 13 #include <fwMedData/Series.hpp> 14 #include <fwMedData/Study.hpp> 16 #include <boost/algorithm/string.hpp> 23 fwActivitiesValidatorRegisterMacro(
41 const ::fwActivities::registry::ActivityInfo& activityInfo,
42 const ::fwData::Vector::csptr& currentSelection )
const 46 if(currentSelection->size() > 1)
48 validation.first =
true;
49 validation.second =
"Selected series refers to the same study.";
51 ::fwMedData::Series::sptr seriesRef = ::fwMedData::Series::dynamicCast((*currentSelection)[0]);
52 ::fwMedData::Study::sptr studyRef = seriesRef->getStudy();
54 std::string instanceUIDRef = studyRef->getInstanceUID();
55 ::boost::algorithm::trim(instanceUIDRef);
57 ::fwData::Vector::ContainerType::const_iterator it;
58 for(it = currentSelection->begin() + 1; it != currentSelection->end(); ++it)
60 ::fwMedData::Series::sptr series = ::fwMedData::Series::dynamicCast(*it);
61 ::fwMedData::Study::sptr study = series->getStudy();
63 std::string instanceUID = study->getInstanceUID();
64 ::boost::algorithm::trim(instanceUID);
66 if(instanceUIDRef != instanceUID)
68 validation.first =
false;
69 validation.second =
"Selected series do not refer to the same study.";
77 validation.first =
true;
78 validation.second =
"Only one series provided to check study affiliation, assuming validation as ok.";
std::pair< bool, std::string > ValidationType
Defines validation result of an activity. First element tells if the activity is validated or not by ...
Namespace containing activities data and builder.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.