[ITK] How to get to get image similarity metrics under .NET ?

Oleg Subachev osubachev at gmail.com
Thu Nov 19 02:01:31 EST 2015


Thanks all of you.
But now the code:
using ( ImageRegistrationMethod method = new ImageRegistrationMethod() )
{
method.SetMetricAsMattesMutualInformation();
double metric = method.MetricEvaluate(
SimpleITK.ReadImage( "1.png", PixelIDValueEnum.sitkFloat32
),SimpleITK.ReadImage( "2.png", PixelIDValueEnum.sitkFloat32 ));
}

throws new exception:
{"Exception thrown in SimpleITK
ImageRegistrationMethod_MetricEvaluate:
..\\..\\..\\..\\..\\SimpleITK\\Code\\Registration\\src\\sitkImageRegistrationMethod.cxx:922:\nsitk::ERROR:
Unexpected error converting initial transform! Possible miss matching
dimensions!"}

-- 
Best regards,
Oleg Subachev


On Wed, Nov 18, 2015 at 8:14 PM, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C]
<zivrafael.yaniv at nih.gov> wrote:
> Hello Oleg,
>
> The ImageRegistrationMethod only supports images with pixel type
> sitkFloat32 and sitkFloat64. You can either specify the pixel type when
> reading the image
> (http://www.itk.org/SimpleITKDoxygen/html/namespaceitk_1_1simple.html#a02ff
> c30c3c55dd9eeff3f76ba19f35e7) or read the image with its native pixel type
> and then
> use the SimpleITK Cast function
> (http://www.itk.org/SimpleITKDoxygen/html/namespaceitk_1_1simple.html#af8c9
> d7cc96a299a05890e9c3db911885), casting it to either of these two types.
>
>    Ziv
>
>
>
> On 11/18/15, 9:51 AM, "Oleg Subachev" <osubachev at gmail.com> wrote:
>
>>Thanks, Brad.
>>
>>But when I try this code:
>>using ( ImageRegistrationMethod method = new ImageRegistrationMethod() )
>>{
>>method.SetMetricAsMattesMutualInformation( 50 );
>>double metric = method.MetricEvaluate( SimpleITK.ReadImage( "1.png" ),
>>SimpleITK.ReadImage( "2.png" ) );
>>}
>>
>>I get the exception:
>>{"Exception thrown in SimpleITK
>>ImageRegistrationMethod_MetricEvaluate:
>>..\\..\\..\\..\\..\\SimpleITK\\Code\\Registration\\src\\sitkImageRegistrat
>>ionMethod.cxx:862:\nsitk::ERROR:
>>Filter does not support fixed image type: vector of 8-bit unsigned
>>integer"}
>>
>>What's wrong ?
>>What is the simplest way to get similarity value of two image files ?
>>
>>--
>>Best regards,
>>Oleg Subachev
>>
>>On Tue, Nov 17, 2015 at 6:41 PM, Bradley Lowekamp
>><blowekamp at mail.nih.gov> wrote:
>>> Hello,
>>>
>>> You should look into SimpleITK's
>>>ImageRegistrationMethod::MetricEvaluate( Image, Image ) member function.
>>>
>>> Here is a Python example of using the method, C# should be similar:
>>>
>>>
>>>http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/63_Registr
>>>ation_Initialization.html
>>>
>>> HTH,
>>> Brad
>>>
>>> On Nov 17, 2015, at 8:24 AM, Oleg Subachev <osubachev at gmail.com> wrote:
>>>
>>>> I need to get similarity metrics for 2D images under .NET.
>>>> According to ITK documentation
>>>> (http://www.itk.org/Doxygen/html/ImageSimilarityMetricsPage.html)
>>>> there are several Image To Image metrics available.
>>>> ITK itself contains corresponding methods.
>>>> But I cannot find those methods in SimpleITK :-(
>>>> There is SimpleITK.NormalizedCorrelation(Image, Image, Image) method,
>>>> but it seems to have nothing with similarity metrics.
>>>>
>>>> How to get to get image similarity metrics under .NET ?
>>>>
>>>> --
>>>> Best regards,
>>>>
>>>> Oleg Subachev
>>>> _______________________________________________
>>>> Community mailing list
>>>> Community at itk.org
>>>> http://public.kitware.com/mailman/listinfo/community
>>>
>>_______________________________________________
>>Community mailing list
>>Community at itk.org
>>http://public.kitware.com/mailman/listinfo/community
>


More information about the Community mailing list