Hi again, sorry to insist but I am stuck on something that I believe should be easy to fix.
For those who work with image registration: how do you save your transformation to file? I used to save them to file very straightforward with itk 3.2 Is the following code correct? thank you! sebastian const TransformType* transform = this->GetLandmarkTransform(); // TransformType is of type itk::VersorRigid3DTransform< double > typedef itk::TransformFileWriterTemplate<double> TransformWriterType; TransformWriterType::Pointer writer = TransformWriterType::New(); writer->SetInput(transform); writer->SetFileName("test.tfm"); try { writer->Update(); } catch (itk::ExceptionObject& e) { MITK_ERROR << "Caught exception: " << e.GetDescription(); QMessageBox::information( this, "Save transform", "Could not save transform. See error log for details." ); } On 23/05/2016 02:43 p.m., Sebastian Ordas wrote: > Dear MITK team, > > It looks like I am missing something very obvious, maybe some factory > is not being executed, but I cannot write my transformation to disk. I > tried .tfm, .par, .txt extensions as well > > mitk::Geometry3D::TransformType is of type: > > typedef itk::VersorRigid3DTransform< double > LandmarkTransformType; > > also tried: > > itk::TransformFileWriterTemplate<double>::Pointer writer = > itk::TransformFileWriterTemplate<double>::New(); > > I´m running this code from the image registration plugin > > many thanks, > > sebastian > > ERROR: Caught exception: itk::ERROR: > TransformFileWriterTemplate(000000000CD770E0): Can't Create IO object > for file D:/Data > /mitk/fiducials.tfm > > QString fileName = QFileDialog::getSaveFileName(m_Parent, "Choose > file to export transform", "", "Transform files (*.tfm)"); > if (fileName.isEmpty()) > return; > > std::string suffix = QFileInfo(fileName).suffix().toStdString(); > if (suffix != "tfm") > { > fileName += ".tfm"; > } > > mitk::Geometry3D::TransformType::ConstPointer transform = > m_MovingGeometry->GetIndexToWorldTransform(); > > itk::TransformFileWriter::Pointer writer = > itk::TransformFileWriter::New(); > writer->SetFileName(fileName.toLatin1()); > writer->SetInput( transform ); > try > { > writer->Update(); > } > catch (itk::ExceptionObject e) > { > MITK_ERROR << "Caught exception: " << e.GetDescription(); > QMessageBox::information( m_Parent, "Image Registration plugin", > "Could not export transform. See error log for details." ); > } > ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users