[prev in list] [next in list] [prev in thread] [next in thread]
List: insight-users
Subject: Re: [Insight-users] saving the registration transform to disk
From: Christopher Mullins <christopher.mullins () kitware ! com>
Date: 2013-02-22 16:13:30
Message-ID: CABVTP-L6QHdtUB1wTjJgR+q6WYaoGw+UdCRnVXAkXqjH_Ww9Qg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Thanks for keeping responses on the list!
From Ronn:
Hi Chris,
Thanks for the reply.
Your code did show what I needed to do, but I get this error
errDesc = 0x000000000a708ff0 "itk::ERROR:
TransformFileWriter(**000000000A704480):
Can't Create IO object for file C:\test.tfm"
Any ideas?
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 Fri, Feb 22, 2013 at 11:07 AM, ronn kling <ronn@rlkling.com> wrote:
> 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@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@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
>>
>>
>
--
Christopher Mullins
R&D Engineer
Kitware Inc.,
919.869.8871
[Attachment #5 (text/html)]
<div dir="ltr">Thanks for keeping responses on the list!<div style>From \
Ronn:</div><div style><br></div><div style><span \
style="font-family:arial,sans-serif;font-size:13px">Hi Chris,</span><br \
style="font-family:arial,sans-serif;font-size:13px"> <br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px">Thanks for the reply.</span><br \
style="font-family:arial,sans-serif;font-size:13px"><br \
style="font-family:arial,sans-serif;font-size:13px"> <span \
style="font-family:arial,sans-serif;font-size:13px">Your code did show what I needed \
to do, but I get this error</span><br \
style="font-family:arial,sans-serif;font-size:13px"><br \
style="font-family:arial,sans-serif;font-size:13px"> <span \
style="font-family:arial,sans-serif;font-size:13px">errDesc = 0x000000000a708ff0 \
"itk::ERROR: TransformFileWriter(</span><u \
style="font-family:arial,sans-serif;font-size:13px"></u><span \
style="font-family:arial,sans-serif;font-size:13px">000000000A</span><span \
style="font-family:arial,sans-serif;font-size:13px">704480): Can't Create IO \
object for file C:\test.tfm"</span><br \
style="font-family:arial,sans-serif;font-size:13px"> <br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px">Any ideas?</span><br \
style="font-family:arial,sans-serif;font-size:13px"><br \
style="font-family:arial,sans-serif;font-size:13px"> <span \
style="font-family:arial,sans-serif;font-size:13px">My code snippet is</span><br \
style="font-family:arial,sans-serif;font-size:13px"><br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px"> \
transform->SetParameters( finalParameters );</span><br \
style="font-family:arial,sans-serif;font-size:13px"> <br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px"> try {</span><br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px"> \
itk::TransformFileWriter::</span><u \
style="font-family:arial,sans-serif;font-size:13px"></u><span \
style="font-family:arial,sans-serif;font-size:13px">Poin</span><span \
style="font-family:arial,sans-serif;font-size:13px">ter writer = \
itk::TransformFileWriter::New(</span><u \
style="font-family:arial,sans-serif;font-size:13px"></u><span \
style="font-family:arial,sans-serif;font-size:13px">);</span><br \
style="font-family:arial,sans-serif;font-size:13px"> <span \
style="font-family:arial,sans-serif;font-size:13px"> \
writer->SetInput(transform);</span><br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px"> \
writer->SetFileName("C:\\</span><span \
style="font-family:arial,sans-serif;font-size:13px">test.</span><u \
style="font-family:arial,sans-serif;font-size:13px"></u><span \
style="font-family:arial,sans-serif;font-size:13px">tfm");</span><br \
style="font-family:arial,sans-serif;font-size:13px"> <span \
style="font-family:arial,sans-serif;font-size:13px"> writer->Update();</span><br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px"> }</span><br \
style="font-family:arial,sans-serif;font-size:13px"> <span \
style="font-family:arial,sans-serif;font-size:13px"> catch( \
itk::ExceptionObject & err ){</span><br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px"> std::cerr \
<< "ITK test driver caught an ITK exception:\n";</span><br \
style="font-family:arial,sans-serif;font-size:13px"> <span \
style="font-family:arial,sans-serif;font-size:13px"> err.Print(std::cerr);</span><br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px"> const char* errDesc = \
err.GetDescription();</span><br style="font-family:arial,sans-serif;font-size:13px"> \
<span style="font-family:arial,sans-serif;font-size:13px"> return \
(-1);</span><br style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px"> }</span><br \
style="font-family:arial,sans-serif;font-size:13px"> <br \
style="font-family:arial,sans-serif;font-size:13px"><span \
style="font-family:arial,sans-serif;font-size:13px">Thanks!</span><br></div></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 22, 2013 at 11:07 \
AM, ronn kling <span dir="ltr"><<a href="mailto:ronn@rlkling.com" \
target="_blank">ronn@rlkling.com</a>></span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">So I tried what Chris suggested and got this \
error<div class="im"><div><br></div><div>errDesc = 0x000000000a708ff0 \
"itk::ERROR: TransformFileWriter(000000000A704480): Can't Create IO object \
for file C:\test.tfm"<br>
</div><div><br></div></div><div class="im"><div>My code snippet is \
</div><div><br></div><div>transform->SetParameters( finalParameters );<br><br>try \
{<br>itk::TransformFileWriter::Pointer writer = itk::TransformFileWriter::New();<br> \
writer->SetInput(transform);<br> \
writer->SetFileName("C:\\test.tfm");<br> \
writer->Update();<br>}<br>catch( itk::ExceptionObject & err ){<br> \
std::cerr << "ITK test driver caught an ITK exception:\n";<br> \
err.Print(std::cerr);<br> const char* errDesc = err.GetDescription();<br>return \
(-1);<br>}<br></div><div>Thanks!</div></div></div><div class="HOEnZb"><div \
class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 18, \
2013 at 10:00 AM, Christopher Mullins <span dir="ltr"><<a \
href="mailto:christopher.mullins@kitware.com" \
target="_blank">christopher.mullins@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">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].<div>
<br>
</div><div>[1] <a href="https://github.com/chrismullins/VesselRegistration/blob/master/vesselRegistration.cxx#L98" \
target="_blank">https://github.com/chrismullins/VesselRegistration/blob/master/vesselRegistration.cxx#L98</a></div>
<div>[2] <a href="http://www.na-mic.org/svn/Slicer3-lib-mirrors/trunk/Insight/Examples/IO/TransformReadWrite.cxx" \
target="_blank">http://www.na-mic.org/svn/Slicer3-lib-mirrors/trunk/Insight/Examples/IO/TransformReadWrite.cxx</a></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Mon, Feb \
18, 2013 at 10:21 AM, ronn kling <span dir="ltr"><<a \
href="mailto:ronn@rlkling.com" target="_blank">ronn@rlkling.com</a>></span> \
wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div><div><div dir="ltr"><span \
style="font-family:arial,sans-serif;font-size:13px">All,</span><div \
style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">I'm new to \
ITK, so I may be asking a simple question.</div> <div \
style="font-family:arial,sans-serif;font-size:13px"><br></div><div \
style="font-family:arial,sans-serif;font-size:13px">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. </div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div \
style="font-family:arial,sans-serif;font-size:13px">If someone could point me to an \
example or a previous post on this list, I would appreciate it.</div>
</div>
<br></div></div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> <br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" \
target="_blank">http://www.kitware.com/products/protraining.php</a><br> <br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" \
target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br> <br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" \
target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br> \
<br></blockquote></div><span><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br>Christopher Mullins<div>R&D \
Engineer</div><div>Kitware Inc.,</div><div><a href="tel:919.869.8871" \
value="+19198698871" target="_blank">919.869.8871</a></div>
</font></span></div>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> <br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" \
target="_blank">http://www.kitware.com/products/protraining.php</a><br> <br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" \
target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br> <br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" \
target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br> \
<br></blockquote></div><br></div> </div></div></blockquote></div><br><br \
clear="all"><div><br></div>-- <br>Christopher Mullins<div>R&D \
Engineer</div><div>Kitware Inc.,</div><div>919.869.8871</div> </div>
_____________________________________
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic