36 #include "boost/bind.hpp"
37 #include "libQtSignalAdapters/Qt2Func.h"
38 #include "libQtSignalAdapters/ConnectionFactories.h"
78 return mBase->setValue(value);
83 return mBase->getValue();
89 return mBase->getDisplayName();
95 return mBase->getValueRange();
100 return mBase->convertInternal2Display(
internal);
106 return QString(
"<html>"
107 "<h4>%1</h4> <p>%2</p>"
108 "<h4>%3</h4> <p>%4</p>"
110 .arg(
"Input").arg(
mInput->getHelp())
111 .arg(
"Output").arg(
mBase->getHelp());
116 return mBase->getData();
130 mBase->setHelp(text);
136 this->blockSignals(
true);
138 this->blockSignals(
false);
156 mPatientModelService(patientModelService)
165 for (
unsigned i=0; i<mFilters->size(); ++i)
168 filter->getInputTypes();
169 filter->getOutputTypes();
170 filter->getOptions();
175 for (
unsigned i=0; i<mFilters->size(); ++i)
193 for (
unsigned i=0; i<mFilters->size(); ++i)
196 std::vector<PropertyPtr> options = filter->getOptions();
198 for (
unsigned j=0; j<options.size(); ++j)
200 if (options[j]->getDisplayName()==valueName)
208 if (value.canConvert<
bool>())
212 specific->
setValue(qvariant_cast<bool>(value));
214 else if (value.canConvert<
double>())
218 specific->setValue(qvariant_cast<double>(value));
220 else if (value.canConvert<QColor>())
224 specific->setValue(qvariant_cast<QColor>(value));
226 else if (value.canConvert<QString>())
230 specific->setValue(qvariant_cast<QString>(value));
234 reportWarning(QString(
"Attempt to set option of type %2 is not supported").arg(value.typeName()));
244 mNodes = this->createNodes();
248 std::vector<SelectDataStringPropertyBasePtr> Pipeline::createNodes()
253 std::vector<SelectDataStringPropertyBasePtr> retval;
255 if (mFilters->empty())
259 retval.push_back(mFilters->get(0)->getInputTypes()[0]);
262 for (
unsigned i=1; i<mFilters->size(); ++i)
268 node->setValueName(QString(
"Node %1").arg(i));
269 retval.push_back(node);
273 retval.push_back(mFilters->get(mFilters->size()-1)->getOutputTypes()[0]);
275 for (
unsigned i=0; i<retval.size(); ++i)
276 QtSignalAdapters::connect1<
void(QString)>(retval[i].get(), SIGNAL(dataChanged(QString)),
288 for (
unsigned i=index+1; i<mNodes.size(); ++i)
289 mNodes[i]->setValue(
"");
294 return mTimedAlgorithm[uid];
299 return mCompositeTimedAlgorithm;
307 int startIndex = endIndex;
311 endIndex = mFilters->size();
312 startIndex = endIndex;
316 for (
unsigned i=0; i<mFilters->size(); ++i)
317 if (mFilters->get(i)->getUid()==uid)
319 startIndex = endIndex-1;
332 for ( ; startIndex>=-1; --startIndex)
336 if (mNodes[startIndex]->getData())
340 std::cout <<
"Pipeline::execute filter range s=|" << startIndex <<
"," << endIndex <<
">" << std::endl;
344 reportWarning(QString(
"Cannot execute filter %1: No input data set").arg(uid));
348 mCompositeTimedAlgorithm->clear();
349 for (
unsigned i=startIndex; i<endIndex; ++i)
350 mCompositeTimedAlgorithm->append(mTimedAlgorithm[mFilters->get(i)->getUid()]);
353 mCompositeTimedAlgorithm->execute();
virtual bool setValue(bool value)=0
set the data value.
void nodeValueChanged(QString uid, int index)
Pipeline(PatientModelServicePtr patientModelService, QObject *parent=0)
FilterGroupPtr getFilters() const
void dataChanged(QString)
void execute(QString uid="")
void initialize(FilterGroupPtr filter)
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class Filter > FilterPtr
boost::shared_ptr< class SelectDataStringPropertyBase > SelectDataStringPropertyBasePtr
boost::shared_ptr< class TimedBaseAlgorithm > TimedAlgorithmPtr
void setOption(QString valueName, QVariant value)
boost::shared_ptr< class Property > PropertyPtr
void reportWarning(QString msg)
boost::shared_ptr< class StringPropertyFusedInputOutputSelectData > StringPropertyFusedInputOutputSelectDataPtr
boost::shared_ptr< class BoolPropertyBase > BoolPropertyBasePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
boost::shared_ptr< FilterGroup > FilterGroupPtr
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
void changed()
emit when the underlying data value is changed: The user interface will be updated.
TimedAlgorithmPtr getTimedAlgorithm(QString uid)
boost::shared_ptr< class ColorPropertyBase > ColorPropertyBasePtr
std::vector< SelectDataStringPropertyBasePtr > getNodes()
TimedAlgorithmPtr getPipelineTimedAlgorithm()
boost::shared_ptr< class StringPropertyBase > StringPropertyBasePtr