[Insight-users] problem with TransformFileReader

Xabier Artaechevarria Artieda xabiarta at unav.es
Tue Jan 2 10:25:53 EST 2007


Hi Luis,
Thanks for your rapid answer.
I actually solved the problem by updating the Transform Reader before  
GetParameters(). I forgot it because I am used to ImageToImage  
filters, where a single Update() in the end is enough to execute the  
whole pipeline.
Best regards,
Xabi

-- 
Xabier Artaechevarria
Cancer Imaging Laboratory
Centre for Applied Medical Research
www.cima.es



Luis Ibanez <luis.ibanez at kitware.com> ha escrito:

>
> Hi Xabier,
>
> You probably should check whether the iterator returned by
> the "begin()" method is valid or not, before attempting to
> use it.
>
>
> You could use code that looks something like:
>
>
> TransformListType::const_iterator tit = transforms->begin();
> if( tit != transforms->end() )
>   {
>   const TransformType * readTransform = *tit;
>   if( readTransform )
>     {
>     transform->SetParameters( readTransform->GetParameters() );
>     }
>   else
>     {
>     std::cerr << "Invalid Transform pointer" << std::endl;
>     }
>   }
> else
>   {
>   std::cerr << "Invalid Iterator" << std::endl;
>   }
>
>
> Please give it a try to the code above and let us know
> where exactly the run-time error is happening.
>
>
>   Thanks,
>
>
>       Luis
>
>
>
> =======================================
> Xabier Artaechevarria Artieda wrote:
>> Hello,
>> I am trying to read a Transform File containing the parameters of a  
>>  3D affine transformation. I get a segmentation fault when trying  
>> to  read the parameters contained in the file, at this point of the  
>> code:
>>
>> TransformListType transforms = transformReader->GetTransformList();
>> transform->SetParameters((*transforms->begin())->GetParameters());
>>
>> The transform file looks like this:
>>
>> #Insight Transform File V1.0
>> # Transform 0
>> Transform: AffineTransform_double_3_3
>> Parameters: 1.00407 0.00202538 -0.000346736 0.00274766 1.00089    
>> 0.00463338 -0.00186666 -0.00160371 0.997568 22.8463 16.5753 -19.3539
>> FixedParameters: 0 0 0
>>
>> I have noticed that the segmentation fault occurs when    
>> "GetParameters()" is executed, but I do not why. Any suggestion   
>> that  may help in finding the problem will be very welcome. Thanks   
>> a lot and happy new year to everybody.
>>



----------------------------------------------------------------
Este mensaje ha sido enviado desde https://webmail.unav.es



More information about the Insight-users mailing list