<div dir="ltr"><div><div><div><div>Hi Matt.<br></div>I've already solved the texture features problem.<br></div>The solution is similar to that of the shape features. You must set a value or values to the filter in order to be able to calculate the features. I've used the <a class="" href="http://www.itk.org/Doxygen/html/classitk_1_1Statistics_1_1ScalarImageToTextureFeaturesFilter.html#a373867fa4b665bc5e4b56fea305ed774">SetPixelValueMinMax</a>() method and everything OK.<br></div>Thank you very much for your support.<br></div>/Francisco<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-15 20:08 GMT+01:00 Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Francisco,<br>
<br>
Good to hear the BinaryImageToShapeLabelMapFilter is working.<br>
<br>
This is probably not the source of your issues, but this line<br>
<span class=""><br>
FeatureValueVectorType* output = textureFilter->GetFeatureMeans();<br>
<br>
</span>should be<br>
<br>
FeatureValueVectorType::Pointer output = textureFilter->GetFeatureMeans();<br>
<br>
since itk::SmartPointer's [1] are different from raw pointers.<br>
<br>
HTH,<br>
Matt<br>
<br>
[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1SmartPointer.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1SmartPointer.html</a><br>
<br>
<br>
On Thu, Jan 15, 2015 at 12:34 PM, Francisco Lopez de la Franca<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:franciscolopezdelafranca@gmail.com">franciscolopezdelafranca@gmail.com</a>> wrote:<br>
> Sorry, I might press the wrong key.<br>
> Hi Matt again.<br>
> You were fully right about setting the background/foreground values for the<br>
> filter. I wasn't using them because I followed the examples and there was no<br>
> reference to them. Now my shape related functions are working.<br>
><br>
> As for the textures, I attach my code so that anyone can see if i am doing<br>
> something wrong:<br>
><br>
> typedef itk::Statistics::ScalarImageToTextureFeaturesFilter<TInputImage><br>
> TextureFilterType;<br>
> typedef typename TextureFilterType::Pointer TextureFilterPtr;<br>
> typedef typename TextureFilterType::FeatureValueVector<br>
> FeatureValueVectorType;<br>
><br>
> TextureFilterPtr textureFilter = TextureFilterType::New();<br>
> textureFilter->SetInput(_input);<br>
> textureFilter->Update();<br>
><br>
> FeatureValueVectorType* output = textureFilter->GetFeatureMeans();<br>
><br>
> cout << "Energy = " << (*output)[0]) << endl;<br>
> cout << "Entropy " << (*output)[1]);<br>
> cout << "LocalHomogeneity = " << (*output)[3]) << endl;<br>
> cout << "Inertia = " << (*output)[4]) << endl;<br>
> cout << "ClusterShade " << (*output)[5]) << endl;<br>
> cout << "ClusterProminence = " << (*output)[6]) << endl;<br>
><br>
> Sincereously, I thank you a lot your help.<br>
> Regards.<br>
> /Francisco<br>
><br>
><br>
><br>
> 2015-01-15 18:26 GMT+01:00 Francisco Lopez de la Franca<br>
> <<a href="mailto:franciscolopezdelafranca@gmail.com">franciscolopezdelafranca@gmail.com</a>>:<br>
>><br>
>> Hi Matt again.<br>
>> You were fully right about setting the background/foreground values for<br>
>> the filter. I<br>
>><br>
>> 2015-01-15 16:41 GMT+01:00 Matt McCormick <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>>:<br>
>>><br>
>>> Hi Francisco,<br>
>>><br>
>>> There is definitely something wrong with the textures features. It is<br>
>>> not possible to know what is going on without more details, though.<br>
>>><br>
>>> Matt<br>
>>><br>
>>> On Thu, Jan 15, 2015 at 1:32 AM, Francisco Lopez de la Franca<br>
>>> <<a href="mailto:franciscolopezdelafranca@gmail.com">franciscolopezdelafranca@gmail.com</a>> wrote:<br>
>>> > Hi Matt,<br>
>>> > Thanks a lot for your answers. I'll try this afternoon what you suggest<br>
>>> > regarding the shape filter, but what do you think about my results as<br>
>>> > for<br>
>>> > the texture filter?<br>
>>> > Regards.<br>
>>> > /Francisco<br>
>>> ><br>
>>> > 2015-01-15 2:30 GMT+01:00 Matt McCormick <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>>:<br>
>>> >><br>
>>> >> Hi Francisco,<br>
>>> >><br>
>>> >> Great to hear about the progress!<br>
>>> >><br>
>>> >> The itk::BinaryImageToShapeLabelMapFilter requires a binary input,<br>
>>> >> which should have an integer pixel type, like unsigned char or<br>
>>> >> unsigned short. It is important to set the BackgroundValue and<br>
>>> >> ForegroundValue [1] to get this filter to work correctly.<br>
>>> >><br>
>>> >> HTH,<br>
>>> >> Matt<br>
>>> >><br>
>>> >> [1]<br>
>>> >><br>
>>> >> <a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToShapeLabelMapFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToShapeLabelMapFilter.html</a><br>
>>> >><br>
>>> >> On Wed, Jan 14, 2015 at 5:05 PM, Francisco Lopez de la Franca<br>
>>> >> <<a href="mailto:franciscolopezdelafranca@gmail.com">franciscolopezdelafranca@gmail.com</a>> wrote:<br>
>>> >> > Hi again.<br>
>>> >> > I fixed all the errors and got my library, now ready to be tested.<br>
>>> >> > It contains an encapsulation, on the one hand, of the class<br>
>>> >> > itkBinaryImageToShapeLabelMapFilter in order to get image shape<br>
>>> >> > descriptors<br>
>>> >> > of a 3D binary image, and on the other hand, the same for the class<br>
>>> >> > itkScalarImageToTextureFeaturesFilter to get image texture features<br>
>>> >> > of a<br>
>>> >> > 3D<br>
>>> >> > scalar image.<br>
>>> >> ><br>
>>> >> > I pass as input image to both classes a binary 3D Nifti image<br>
>>> >> > (150x150x150)<br>
>>> >> > containing a cylinder where the inside voxels are 255 and the<br>
>>> >> > outside<br>
>>> >> > voxels<br>
>>> >> > are 0.<br>
>>> >> ><br>
>>> >> > As for the shape issue, it's very strange to me that the call to<br>
>>> >> > GetNumberOfLabelObjects on a itk::LabelMap object returns a value of<br>
>>> >> > 0.<br>
>>> >> > The<br>
>>> >> > main code is as follows:<br>
>>> >> ><br>
>>> >> > binaryImageToShapeLabelMapFilter->SetInput(_input);<br>
>>> >> > binaryImageToShapeLabelMapFilter->ComputePerimeterOn();<br>
>>> >> > binaryImageToShapeLabelMapFilter->Update();<br>
>>> >> ><br>
>>> >> > LabelMapType::Pointer labelMap =<br>
>>> >> > binaryImageToShapeLabelMapFilter->GetOutput();<br>
>>> >> ><br>
>>> >> > int nrOfLabelObjects = labelMap->GetNumberOfLabelObjects();<br>
>>> >> ><br>
>>> >> ><br>
>>> >> > And, as for the texture features, the result of the filter does not<br>
>>> >> > seem<br>
>>> >> > to<br>
>>> >> > be very logic:<br>
>>> >> ><br>
>>> >> > Energy = 1<br>
>>> >> > Entropy = 0<br>
>>> >> > Correlation = 1<br>
>>> >> > Local Homogeneity = 0<br>
>>> >> > Inertia = 0<br>
>>> >> > Cluster Shade = 0<br>
>>> >> > Cluster Prominence = 0<br>
>>> >> ><br>
>>> >> > I've also tested this with a scalar 3D Nifti image and the results<br>
>>> >> > are<br>
>>> >> > the<br>
>>> >> > same.<br>
>>> >> ><br>
>>> >> > And the question is: What kind of image do I have to pass to the<br>
>>> >> > filters<br>
>>> >> > so<br>
>>> >> > that the code would return a more logic expected answer?<br>
>>> >> ><br>
>>> >> > Thank you very much in advance.<br>
>>> >> > My best regars.<br>
>>> >> > /Francisco<br>
>>> >> ><br>
>>> >> > 2015-01-10 22:38 GMT+01:00 Matt McCormick<br>
>>> >> > <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>>:<br>
>>> >> >><br>
>>> >> >> Hi Francisco,<br>
>>> >> >><br>
>>> >> >> Nice to hear about the progress!<br>
>>> >> >><br>
>>> >> >> You will need to link your library to the ITK libraries:<br>
>>> >> >><br>
>>> >> >> target_link_libraries( mylibrary ${ITK_LIBRARIES} )<br>
>>> >> >><br>
>>> >> >> HTH,<br>
>>> >> >> Matt<br>
>>> >> >><br>
>>> >> >> On Sat, Jan 10, 2015 at 4:16 PM, Francisco Lopez de la Franca<br>
>>> >> >> <<a href="mailto:franciscolopezdelafranca@gmail.com">franciscolopezdelafranca@gmail.com</a>> wrote:<br>
>>> >> >>><br>
>>> >> >>> Thanks to your previous answer the problem was solved, but another<br>
>>> >> >>> one<br>
>>> >> >>> has come out. It occurs when linking to create the library. It<br>
>>> >> >>> gives<br>
>>> >> >>> an<br>
>>> >> >>> undefined reference to itk::ExceptionObject::ExceptionObject... as<br>
>>> >> >>> you<br>
>>> >> >>> can<br>
>>> >> >>> see below.<br>
>>> >> >>> What it is strange to me is that before including explicit<br>
>>> >> >>> template<br>
>>> >> >>> instantiation, I created the library without errors, and now that<br>
>>> >> >>> I<br>
>>> >> >>> include<br>
>>> >> >>> that, I get this error.<br>
>>> >> >>> I'll appreciate very much any help.<br>
>>> >> >>><br>
>>> >> >>> Linking CXX shared library libTFM_Features.dll<br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>> CMakeFiles\TFM_Features.dir/objects.a(TFM_Features.cpp.obj):TFM_Features.cpp:(.t<br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>> ext$_ZN3itk21MemoryAllocationErrorC1ERKSsjS2_S2_[_ZN3itk21MemoryAllocationErrorC<br>
>>> >> >>> 1ERKSsjS2_S2_]+0x35): undefined reference to<br>
>>> >> >>> `itk::ExceptionObject::ExceptionObj<br>
>>> >> >>> ect(std::string const&, unsigned int, std::string const&,<br>
>>> >> >>> std::string<br>
>>> >> >>> const&)'<br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>> CMakeFiles\TFM_Features.dir/objects.a(TFM_Features.cpp.obj):TFM_Features.cpp:(.t<br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>> ext$_ZN3itk21MemoryAllocationErrorC1ERKSsjS2_S2_[_ZN3itk21MemoryAllocationErrorC<br>
>>> >> >>> 1ERKSsjS2_S2_]+0x40): undefined reference to `vtable for<br>
>>> >> >>> itk::MemoryAllocationEr<br>
>>> >> >>> ror'<br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>> C:/CV/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-min<br>
>>> >> >>> gw32/bin/ld.exe:<br>
>>> >> >>> CMakeFiles\TFM_Features.dir/objects.a(TFM_Features.cpp.obj): ba<br>
>>> >> >>> d reloc address 0x40 in section<br>
>>> >> >>> `.text$_ZN3itk21MemoryAllocationErrorC1ERKSsjS2_<br>
>>> >> >>> S2_[_ZN3itk21MemoryAllocationErrorC1ERKSsjS2_S2_]'<br>
>>> >> >>> collect2.exe: error: ld returned 1 exit status<br>
>>> >> >>> SRC\CMakeFiles\TFM_Features.dir\build.make:219: recipe for target<br>
>>> >> >>> 'SRC/libTFM_Fe<br>
>>> >> >>> atures.dll' failed<br>
>>> >> >>> mingw32-make[2]: *** [SRC/libTFM_Features.dll] Error 1<br>
>>> >> >>> CMakeFiles\Makefile2:77: recipe for target<br>
>>> >> >>> 'SRC/CMakeFiles/TFM_Features.dir/all'<br>
>>> >> >>> failed<br>
>>> >> >>> mingw32-make[1]: *** [SRC/CMakeFiles/TFM_Features.dir/all] Error 2<br>
>>> >> >>> Makefile:74: recipe for target 'all' failed<br>
>>> >> >>> mingw32-make: *** [all] Error 2<br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >>> 2015-01-09 21:02 GMT+01:00 Matt McCormick<br>
>>> >> >>> <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>>:<br>
>>> >> >>>><br>
>>> >> >>>> Hi Francisco,<br>
>>> >> >>>><br>
>>> >> >>>> In order for the templates to be available in the library, they<br>
>>> >> >>>> must<br>
>>> >> >>>> be explicitly instantiated [1].<br>
>>> >> >>>><br>
>>> >> >>>> HTH,<br>
>>> >> >>>> Matt<br>
>>> >> >>>><br>
>>> >> >>>> [1] <a href="http://www.cplusplus.com/articles/1C75fSEw/" target="_blank">http://www.cplusplus.com/articles/1C75fSEw/</a><br>
>>> >> >>>><br>
>>> >> >>>> On Fri, Jan 9, 2015 at 2:59 PM, Francisco Lopez de la Franca<br>
>>> >> >>>> <<a href="mailto:franciscolopezdelafranca@gmail.com">franciscolopezdelafranca@gmail.com</a>> wrote:<br>
>>> >> >>>> > Hi.<br>
>>> >> >>>> > I' like to create a library containing, for example, one<br>
>>> >> >>>> > template<br>
>>> >> >>>> > class with<br>
>>> >> >>>> > a number of methods.<br>
>>> >> >>>> > I've programmed a simple example and the compilation and<br>
>>> >> >>>> > generation<br>
>>> >> >>>> > of<br>
>>> >> >>>> > the<br>
>>> >> >>>> > library goes fine. I use the cmake "add_library" command for<br>
>>> >> >>>> > generating the<br>
>>> >> >>>> > library.<br>
>>> >> >>>> ><br>
>>> >> >>>> > The problem arises at the moment of testing the library. I get<br>
>>> >> >>>> > an<br>
>>> >> >>>> > undefined<br>
>>> >> >>>> > reference for every method in the template class.<br>
>>> >> >>>> ><br>
>>> >> >>>> > I've downloaded a tool to look in the contents (functions) of<br>
>>> >> >>>> > dynamic<br>
>>> >> >>>> > libraries, and there is no function in the library. If I add<br>
>>> >> >>>> > another<br>
>>> >> >>>> > class<br>
>>> >> >>>> > (not a template class), then, this tool shows me only the<br>
>>> >> >>>> > functions<br>
>>> >> >>>> > in<br>
>>> >> >>>> > this<br>
>>> >> >>>> > latter class.<br>
>>> >> >>>> ><br>
>>> >> >>>> > Has anyone ever come across with this problem?<br>
>>> >> >>>> ><br>
>>> >> >>>> > Thanks a lot in advance.<br>
>>> >> >>>> > Regards<br>
>>> >> >>>> > /Francisco<br>
>>> >> >>>> ><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<br>
>>> >> >>>> > 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://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
>>> >> >>>> ><br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >><br>
>>> >> ><br>
>>> ><br>
>>> ><br>
>><br>
>><br>
><br>
</div></div></blockquote></div><br></div>