[Insight-users] saving the registration transform to disk

ronn kling ronn at rlkling.com
Fri Feb 22 11:07:13 EST 2013


So I tried what Chris suggested and got this error

errDesc = 0x000000000a708ff0 "itk::ERROR:
TransformFileWriter(000000000A704480): Can't Create IO object for file
C:\test.tfm"

My code snippet is

transform->SetParameters( finalParameters );

try {
itk::TransformFileWriter::Pointer writer = itk::TransformFileWriter::New();
writer->SetInput(transform);
writer->SetFileName("C:\\test.tfm");
writer->Update();
}
catch( itk::ExceptionObject & err ){
std::cerr << "ITK test driver caught an ITK exception:\n";
err.Print(std::cerr);
const char* errDesc = err.GetDescription();
return (-1);
}
Thanks!


On Mon, Feb 18, 2013 at 10:00 AM, Christopher Mullins <
christopher.mullins at kitware.com> wrote:

> I actually did exactly this in one of my projects [1].  Take a look, and
> let me know if this isn't what you're trying to do.  There's probably a
> more generic example of doing this here [2].
>
> [1]
> https://github.com/chrismullins/VesselRegistration/blob/master/vesselRegistration.cxx#L98
> [2]
> http://www.na-mic.org/svn/Slicer3-lib-mirrors/trunk/Insight/Examples/IO/TransformReadWrite.cxx
>
>
> On Mon, Feb 18, 2013 at 10:21 AM, ronn kling <ronn at rlkling.com> wrote:
>
>> All,
>>
>> I'm new to ITK, so I may be asking a simple question.
>>
>> I'm successfully registering two volumes with VersorRigid3DTransform.
>>  What I want to do is save the  transform to disk so that the next time I
>> read the two volumes in I can just apply the transform and go on my merry
>> way.  The problem is, I don't see how to do it.  My first thought was that
>> I could save the versor and then reload it into the ResampleImageFilter,
>> but I don't see how to do that.
>>
>> If someone could point me to an example or a previous post on this list,
>> I would appreciate it.
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
>
> --
> Christopher Mullins
> R&D Engineer
> Kitware Inc.,
> 919.869.8871
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130222/caca8d42/attachment.htm>


More information about the Insight-users mailing list