[Insight-users] Gatens Label Object Representation and Manipulation
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Sat Feb 27 17:18:34 EST 2010
Le 27 févr. 10 à 22:59, Christian Werner a écrit :
> Hi!
>
> Yes, USE_REVIEW is on I am sure about that since I already built
> some libraries. I am using Debian Lenny and gcc 4.4.3. But maybe it
> is only because I misunderstand something.
>
> I see that I need label objects anyway, so it does not harm if I
> include them in my own code. But I was really confused about getting
> errors when just including a single header. Shouldn't this header
> take care of his own dependencies?
>
> Anyway, these 3 lines are the very beginning of my labeling try and
> these already produce errors:
>
> typedef itk::Image< unsigned char, 2 > InputImageType;
> ...
> 56 typedef ShapeLabelObject<unsigned char, 2> LabelObjectType;
> 57 typedef LabelMap< LabelObjectType > LabelMapType;
shouldn't you add the itk:: prefix to those typedefs?
typedef itk::ShapeLabelObject<unsigned char, 2> LabelObjectType;
typedef LabelMap< LabelObjectType > LabelMapType;
a few other notes:
* you may be careful about the type used to store the labels -
unsigned char is likely to become quickly unable to store all the
labels in your image
* when using ShapeLabelObject, it is convenient to use
BinaryImageToShapeLabelMapFilter instead of
BinaryImageToLabelMapFilter: the attribute values are computed with a
single filter, and it can be declared simply as
typedef itk::BinaryImageToLabelMapFilter<InputImageType>
ImageToLabelType;
without much type declaration.
Gaëtan
> 58 typedef itk::BinaryImageToLabelMapFilter<InputImageType,
> LabelMapType> ImageToLabelType;
> 59 //2)
> 60 ImageToLabelType::Pointer image2LabelMap =
> ImageToLabelType::New();
>
> Compiler Errors:
> /home/christian/programming/itk/labeling/testITK.cxx: In function
> ‘int main(int, char**)’:
> /home/christian/programming/itk/labeling/testITK.cxx:56: error:
> expected initializer before ‘<’ token
> /home/christian/programming/itk/labeling/testITK.cxx:57: error:
> expected initializer before ‘<’ token
> /home/christian/programming/itk/labeling/testITK.cxx:58: error:
> ‘LabelMapType’ was not declared in this scope
> /home/christian/programming/itk/labeling/testITK.cxx:58: error:
> template argument 2 is invalid
> /home/christian/programming/itk/labeling/testITK.cxx:58: error:
> invalid type in declaration before ‘;’ token
> /home/christian/programming/itk/labeling/testITK.cxx:60: error:
> expected initializer before ‘image2LabelMap’
>
> Maybe I don't get this labeling right... ?
>
> This is what I include now:
>
> #include "itkImageToImageFilter.h"
> #include "itkShapeLabelObject.h"
> #include "itkLabelMap.h"
> #include "itkBinaryImageToLabelMapFilter.h"
> #include "itkLabelMapToRGBImageFilter.h"
>
>
>
> Bill Lorensen wrote:
>> When you configured ITK did you build with USE_REVIEW ON?
>>
>> If so, what platform/compiler are you using?
>>
>> Bill
>>
>> On Sat, Feb 27, 2010 at 2:24 PM, Christian Werner
>> <christian.werner at rwth-aachen.de> wrote:
>>
>>> Hello!
>>>
>>> I am off to make some serious object labling and manipulation.
>>> Unfortunately
>>> some very basic code does not compile:
>>>
>>> #include "itkBinaryImageToLabelMapFilter.h"
>>> int main( int argc, char * argv[] )
>>> {
>>> }
>>>
>>> christian at trinity:~/programming/itk/labeling/bin$ make -j2
>>> Scanning dependencies of target testITK
>>> [100%] Building CXX object CMakeFiles/testITK.dir/testITK.o
>>> In file included from
>>> /home/christian/programming/itk/labeling/testITK.cxx:2:
>>> /opt/InsightToolkit-3.16.0/Code/Review/
>>> itkBinaryImageToLabelMapFilter.h:54:
>>> error: expected type-specifier before ‘LabelMap’
>>> /opt/InsightToolkit-3.16.0/Code/Review/
>>> itkBinaryImageToLabelMapFilter.h:54:
>>> error: expected ‘>’ before ‘LabelMap’
>>> make[2]: *** [CMakeFiles/testITK.dir/testITK.o] Error 1
>>> make[1]: *** [CMakeFiles/testITK.dir/all] Error 2
>>> make: *** [all] Error 2
>>>
>>> I can fix this, when I edit (and this already feels bad) the
>>> itkBinaryImageToLabelMapFilter.h by adding
>>>
>>> #include "itkLabelMap.h"
>>> #include "itkLabelObject.h"
>>>
>>> The above code compiles this way. However if I actually use some
>>> functions
>>> out of the itkBinaryImageToLabelMapFilter.h I get errors over
>>> errors.
>>>
>>> My CMakeLists looks like this:
>>>
>>> cmake_minimum_required(VERSION 2.4)
>>>
>>> PROJECT(testITK)
>>>
>>> FIND_PACKAGE(ITK REQUIRED)
>>> IF(ITK_FOUND)
>>> INCLUDE(${ITK_USE_FILE})
>>> ENDIF(ITK_FOUND)
>>>
>>> ADD_EXECUTABLE(testITK testITK.cxx)
>>>
>>> TARGET_LINK_LIBRARIES(testITK ITKCommon ITKIO ITKBasicFilters
>>> ITKStatistics)
>>>
>>>
>>> General ITK programming works without trouble. I must be doing
>>> something
>>> totally wrong, any suggestions?
>>>
>>>
>>> Best regards,
>>> Christian
>>>
>>>
>>> _____________________________________
>>> 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.html
>>>
>>> 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
>>>
>>>
>
> _____________________________________
> 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.html
>
> 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
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr http://www.itk.org
http://www.mandriva.org http://www.bepo.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100227/42caccc3/attachment-0001.pgp>
More information about the Insight-users
mailing list