[Insight-users] How to write the content of e.g. itkMatrix in TCL
Frank Lindseth
Frank.Lindseth@sintef.no
Thu, 10 Apr 2003 13:40:51 +0200
--Apple-Mail-2-800691426
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Thanks a lot Luis, I got a bit further.
How am I supposed to set the elements of the transform-parameters (see
below)?
And what about setting/getting the offset/itk::Vector elements ?
For itk::Matrix it looks like I an not able to create an object in TCL,
is there a general description of
the mapping between templated C++ and TCL somewhere?
Also, I want to add an optimizer-observer that can print the
metric-value and transform between
iterations (in tcl). The C++ code is included below, I have not managed
to map it to tcl get.
Regards,
Frank
% set t [ itk::create AffineTransform3 ]
% $t SetIdentity
% set p [$t GetParameters]
% puts [$p () 0]
1.0
% set [$p () 0] 0.5
------> Obviously not the correct way.
% set o [$t GetOffset]
% puts [$o () 0]
No method matches itk::Vector<double,3>::()(int) const
------> Obviously not the correct way.
% set m [$t GetMatrix]
% puts [$m () 0]
invalid command name "_cxx0x3be9ef0"
------> Obviously not the correct way.
% set mm [itk::create Matrix33]
invalid command name "itk::Matrix33"
Observer
-----------------------------------------------------------------
typename CommandType::Pointer cmdOptimizer = CommandType::New();
cmdOptimizer->SetCallbackFunction( this, &Self::optimizerCB );
m_cmdOptTag = m_Optimizer->AddObserver( IterationEvent(),
cmdOptimizer );
---
template <typename TFixedImage, typename TMovingImage>
void
MIMRegistrator<TFixedImage,TMovingImage>
::optimizerCB()
{
std::cout << m_Optimizer->GetCurrentIteration() << " = ";
std::cout << m_Optimizer->GetValue() << " : ";
std::cout << m_Optimizer->GetCurrentPosition();
}
On Thursday, Apr 10, 2003, at 06:09 Europe/Oslo, Luis Ibanez wrote:
>
> Hi Frank
>
> You can use the operator() in the Array of parameters
> in order to print element by element.
>
> For example
>
> set t [ itk::create AffineTransform3 ]
> $t SetIdentity
> set p [$t GetParameters]
>
> $p () 0
> $p () 1
> $p () 2
> $p () 3
> $p () 4
>
> ... and so on..
>
> This equivalent to invoke the operator() in the Array class.
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1Array.html
>
> You will find detailed descriptions of the parameters
> encoding for the transforms in the SoftwareGuide.pdf
>
> http://www.itk.org/ItkSoftwareGuide.pdf
>
> Section 7.7 pdf-pages 214 to 221
>
>
>
> Regards,
>
>
> Luis
>
>
>
> --------------------------------------
>
>
>
> Frank Lindseth wrote:
>> Hi all,
>> Can somebody tell me how to write the content of the following
>> objects (m,o,p)
>> to the command line in TCL: puts ?
>> (I wont to know the exact result of an registration for debugging
>> purposes)
>> % package require InsightToolkit
>> 1.2
>> % set t [ itk::create AffineTransform3 ]
>> % set m [$t GetMatrix]
>> % set o [$t GetOffset]
>> % set p [$t GetParameters]
>> % puts $o
>> _cxx0x3be9800
>> thanks
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users@public.kitware.com
>> http://public.kitware.com/mailman/listinfo/insight-users
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>
--Apple-Mail-2-800691426
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
charset=US-ASCII
Thanks a lot Luis, I got a bit further.
How am I supposed to set the elements of the transform-parameters (see
below)?
And what about setting/getting the offset/itk::Vector elements ?
For itk::Matrix it looks like I an not able to create an object in
TCL, is there a general description of
the mapping between templated C++ and TCL somewhere?
Also, I want to add an optimizer-observer that can print the
metric-value and transform between
iterations (in tcl). The C++ code is included below, I have not
managed to map it to tcl get.
Regards,
Frank
% set t [ itk::create AffineTransform3 ]
% $t SetIdentity
% set p [$t GetParameters]
% puts [$p () 0]
1.0
% set [$p () 0] 0.5
------> Obviously not the correct way.
% set o [$t GetOffset]
% puts [$o () 0]
No method matches itk::Vector<<double,3>::()(int) const
------> Obviously not the correct way.
% set m [$t GetMatrix]
% puts [$m () 0]
invalid command name "_cxx0x3be9ef0"
------> Obviously not the correct way.
% set mm [itk::create Matrix33]
invalid command name "itk::Matrix33"
<fixed><color><param>2322,6E6D,2524</param>Observer
-----------------------------------------------------------------</color>
typename CommandType::Pointer cmdOptimizer = CommandType::New();
cmdOptimizer->SetCallbackFunction( this, &Self::optimizerCB );
m_cmdOptTag = m_Optimizer->AddObserver( IterationEvent(),
cmdOptimizer );
---
template <<typename TFixedImage, typename TMovingImage>
void
MIMRegistrator<<TFixedImage,TMovingImage>
::optimizerCB()
{
std::cout <<<< m_Optimizer->GetCurrentIteration() <<<<
<color><param>8988,1312,1514</param>" = "</color>;
std::cout <<<< m_Optimizer->GetValue() <<<<
<color><param>8988,1312,1514</param>" : "</color>;
std::cout <<<< m_Optimizer->GetCurrentPosition();
}
</fixed>
On Thursday, Apr 10, 2003, at 06:09 Europe/Oslo, Luis Ibanez wrote:
<excerpt>
Hi Frank
You can use the operator() in the Array of parameters
in order to print element by element.
For example
set t [ itk::create AffineTransform3 ]
$t SetIdentity
set p [$t GetParameters]
$p () 0
$p () 1
$p () 2
$p () 3
$p () 4
... and so on..
This equivalent to invoke the operator() in the Array class.
http://www.itk.org/Insight/Doxygen/html/classitk_1_1Array.html
You will find detailed descriptions of the parameters
encoding for the transforms in the SoftwareGuide.pdf
http://www.itk.org/ItkSoftwareGuide.pdf
Section 7.7 pdf-pages 214 to 221
Regards,
Luis
--------------------------------------
Frank Lindseth wrote:
<excerpt>Hi all,
Can somebody tell me how to write the content of the following objects
(m,o,p)
to the command line in TCL: puts ?
(I wont to know the exact result of an registration for debugging
purposes)
% package require InsightToolkit
1.2
% set t [ itk::create AffineTransform3 ]
% set m [$t GetMatrix]
% set o [$t GetOffset]
% set p [$t GetParameters]
% puts $o
_cxx0x3be9800
thanks
_______________________________________________
Insight-users mailing list
Insight-users@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-users
</excerpt>
_______________________________________________
Insight-users mailing list
Insight-users@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-users
</excerpt>
--Apple-Mail-2-800691426--