15 #include "boost/bind.hpp" 16 #include "libQtSignalAdapters/Qt2Func.h" 17 #include "libQtSignalAdapters/ConnectionFactories.h" 57 return mBase->setValue(value);
62 return mBase->getValue();
68 return mBase->getDisplayName();
74 return mBase->getValueRange();
79 return mBase->convertInternal2Display(
internal);
85 return QString(
"<html>" 86 "<h4>%1</h4> <p>%2</p>" 87 "<h4>%3</h4> <p>%4</p>" 89 .arg(
"Input").arg(
mInput->getHelp())
90 .arg(
"Output").arg(
mBase->getHelp());
95 return mBase->getData();
109 mBase->setHelp(text);
115 this->blockSignals(
true);
117 this->blockSignals(
false);
144 for (
unsigned i=0; i<mFilters->size(); ++i)
147 filter->getInputTypes();
148 filter->getOutputTypes();
149 filter->getOptions();
154 for (
unsigned i=0; i<mFilters->size(); ++i)
172 for (
unsigned i=0; i<mFilters->size(); ++i)
175 std::vector<PropertyPtr> options = filter->getOptions();
177 for (
unsigned j=0; j<options.size(); ++j)
179 if (options[j]->getDisplayName()==valueName)
187 if (value.canConvert<
bool>())
191 specific->
setValue(qvariant_cast<bool>(value));
193 else if (value.canConvert<
double>())
197 specific->
setValue(qvariant_cast<double>(value));
199 else if (value.canConvert<QColor>())
203 specific->
setValue(qvariant_cast<QColor>(value));
205 else if (value.canConvert<QString>())
209 specific->
setValue(qvariant_cast<QString>(value));
213 reportWarning(QString(
"Attempt to set option of type %2 is not supported").arg(value.typeName()));
223 mNodes = this->createNodes();
227 std::vector<SelectDataStringPropertyBasePtr> Pipeline::createNodes()
232 std::vector<SelectDataStringPropertyBasePtr> retval;
234 if (mFilters->empty())
238 retval.push_back(mFilters->get(0)->getInputTypes()[0]);
241 for (
unsigned i=1; i<mFilters->size(); ++i)
247 node->setValueName(QString(
"Node %1").arg(i));
248 retval.push_back(node);
252 retval.push_back(mFilters->get(mFilters->size()-1)->getOutputTypes()[0]);
254 for (
unsigned i=0; i<retval.size(); ++i)
255 QtSignalAdapters::connect1<
void(QString)>(retval[i].get(), SIGNAL(dataChanged(QString)),
267 for (
unsigned i=index+1; i<mNodes.size(); ++i)
268 mNodes[i]->setValue(
"");
273 return mTimedAlgorithm[uid];
278 return mCompositeTimedAlgorithm;
286 int startIndex = endIndex;
290 endIndex = mFilters->size();
291 startIndex = endIndex;
295 for (
unsigned i=0; i<mFilters->size(); ++i)
296 if (mFilters->get(i)->getUid()==uid)
298 startIndex = endIndex-1;
311 for ( ; startIndex>=-1; --startIndex)
315 if (mNodes[startIndex]->getData())
319 std::cout <<
"Pipeline::execute filter range s=|" << startIndex <<
"," << endIndex <<
">" << std::endl;
323 reportWarning(QString(
"Cannot execute filter %1: No input data set").arg(uid));
327 mCompositeTimedAlgorithm->clear();
328 for (
unsigned i=startIndex; i<endIndex; ++i)
329 mCompositeTimedAlgorithm->append(mTimedAlgorithm[mFilters->get(i)->getUid()]);
332 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)
Abstract interface for interaction with internal string-valued data.
boost::shared_ptr< class Data > DataPtr
virtual bool setValue(double value)=0
set the data value.
boost::shared_ptr< class Filter > FilterPtr
boost::shared_ptr< class SelectDataStringPropertyBase > SelectDataStringPropertyBasePtr
boost::shared_ptr< class TimedBaseAlgorithm > TimedAlgorithmPtr
boost::shared_ptr< class StringPropertyBase > StringPropertyBasePtr
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
virtual bool setValue(QColor value)=0
set the data value.
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()
virtual bool setValue(const QString &value)=0
set the data value.
PatientModelServicePtr mPatientModelService
Namespace for all CustusX production code.