39 connect(mParameters.get(), SIGNAL(elastixParametersChanged()),
this, SIGNAL(
elastixChanged()));
43 "Display messages from the running registration process in CustusX",
49 "Disable rendering while running process.\n" 50 "Can be used to avoid clash in GPU usage.",
55 connect(mExecuter.get(), SIGNAL(finished()),
this, SLOT(executionFinishedSlot()));
56 connect(mExecuter.get(), SIGNAL(aboutToStart()),
this, SLOT(preprocessExecuter()));
68 void ElastixManager::preprocessExecuter()
70 QStringList parameterFiles = mParameters->getActiveParameterFiles();
72 QDir outDir(mServices->patient()->getActivePatientFolder()+
"/"+mParameters->getConfigUid()+
"/"+timestamp);
74 mExecuter->setDisplayProcessMessages(mDisplayProcessMessages->getValue());
75 mExecuter->setInput(mParameters->getActiveExecutable()->getEmbeddedPath().getAbsoluteFilepath(),
76 mServices->registration()->getFixedData(),
77 mServices->registration()->getMovingData(),
78 outDir.absolutePath(),
81 if (mDisableRendering->getValue())
83 mServices->view()->enableRender(
false);
87 void ElastixManager::executionFinishedSlot()
89 if (mDisableRendering->getValue())
90 mServices->view()->enableRender(
true);
93 Transform3D mMf = mExecuter->getAffineResult_mMf(&ok);
100 QStringList parameterFiles = mParameters->getActiveParameterFiles();
101 QString desc = QString(
"Image2Image [exe=%1]").arg(QFileInfo(mParameters->getActiveExecutable()->getValue()).fileName());
102 for (
unsigned i=0; i<parameterFiles.size(); ++i)
103 desc += QString(
"[par=%1]").arg(QFileInfo(parameterFiles[i]).fileName());
113 mServices->registration()->getFixedData()->get_rMd()
115 * mServices->registration()->getMovingData()->get_rMd().inv();
121 mServices->registration()->addImage2ImageRegistration(delta_pre_rMd, desc);
124 this->addNonlinearData();
131 void ElastixManager::addNonlinearData()
134 QString nonlinearVolumeFilename = mExecuter->getNonlinearResultVolume(&ok);
139 ImagePtr movingImage = boost::dynamic_pointer_cast<
Image>(mServices->registration()->getMovingData());
144 report(QString(
"Failed to import nonlinear volume %1").arg(nonlinearVolumeFilename));
148 QString uid = movingImage->getUid() +
"_nl%1";
149 QString name = movingImage->getName()+
" nl%1";
153 raw->getBaseVtkImageData(), movingImage);
156 nlVolume->get_rMd_History()->setRegistration(mServices->registration()->getFixedData()->get_rMd());
158 mServices->patient()->insertData(nlVolume);
160 report(QString(
"Added volume %1, created by a nonlinear transform").arg(nlVolume->getName()));
cxResource_EXPORT ProfilePtr profile()
static BoolPropertyPtr initialize(const QString &uid, QString name, QString help, bool value, QDomNode root=QDomNode())
static QString getConfigUid()
ElastixManager(RegServicesPtr services)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class Image > ImagePtr
Parameter and preset handling for the ElastiX registration.
QString timestampSecondsFormat()
QDomElement getElement()
return the current element
ImagePtr createDerivedImage(PatientModelServicePtr dataManager, QString uid, QString name, vtkImageDataPtr raw, ImagePtr parent)
ElastiX command-line wrapper.
boost::shared_ptr< class RegServices > RegServicesPtr
virtual ~ElastixManager()
Namespace for all CustusX production code.