[Insight-users] Isosurface using a different image pixel type? Baffled by generic programming.

Luis Ibanez luis.ibanez at kitware.com
Fri May 27 11:16:43 EDT 2005


Hi Robert,


    Welcome to the fascinating world of software documentation  :-)



You are right,

    I may argue that "BinaryMask" in the filter name indicates that
    you are supposed to provide a binary image as the input image.


If fact,


     the argument is so good...  that I'm going to stick to it !




You are also right

       in that *there is* a naming convention for filters.


It is part of the Coding Style guidelines that as any other
document in ITK, is publicly available.


You will find it in the suspicious directory:

                  Insight/Documentation


with the filename

                       Style.pdf


Section 3.4, in pdf-page 8,
presents the naming convention used for ITK classes


http://www.itk.org/cgi-bin/viewcvs.cgi/Documentation/Style.pdf?rev=1.4&root=Insight&view=log



The reason why the Doxygen comment is particularly terse
is that there was a bug in the spelling of the \class
command. We just committed a fix to the CVS repository.
The documentation should show up tomorrow once Doxygen
is rerun overnight.   Thanks for pointing this out.



If you read directly the header file of this class

           [Oh, the Joy of Open Source !!!]

you will find the following paragraph
(that tomorrow will show up in Doxygen):


     "This class tries to construct a 3D mesh surface
      based on a binary mask. It can be used to integrate
      a region-based segmentation method and a deformable
      model into one hybrid framework."




BTW, We don't call the casting filter "ImageFilterCast" but
      "CastImageFilter". Again, this comes from the naming
      style stated in the Style.pdf document.

      Don't get too picky about the naming...
      Note that one of the name proposals for
      this filter was:

     "itkThisIsAFilterThatWillCastOnePixelTypeIntoAnother"


     ...but some people thought that
        the name wasn't specific enough...  :-)



   Best regards,



       Luis



-------------------------
Atwood, Robert C wrote:

> Aha. Perhaps Section 6.10, and/or a comment in the header file or the 
> doxygen description,  could mention that the 
> BinaryMask3DMeshSource expects a binary image? You may argue that the 
> word 'binary' in the name indicates this ... but it is not that obvious 
> since some other part of the operation may involve a binary.  Is there 
> supposed to be a consistent naming convention for filters? I would call 
> it MeshSourceFrom3DBinaryMask or something like that, so that 'Mesh' 
> appears first , when it gets sorted alphabetically, so it would be near 
> other classes that work with meshes.
>  
> Also , the presence of the command
>   meshSource->SetObjectValue( isovalue );
> 
> in the example led me to  believe that the value for the isosurface is 
> set within the BinaryMask3DMeshSource object, and that therefore the 
> binary masking takes place within this object.
> 
> What is the purpose of this command?  The doxygen is especially terse, 
> ie, completely blank, for this method. I assume it sets either the 
> expected inside or outside value?
> 
> In fact, the image I have been trying to apply this to is already a 
> binary mask anyways, but it is stored as single-byte data (unsigned char 
> )  not (unsigned short int). In this case I used a cast image filter.  
> (I would call it ImageFilterCast ... :-)
> 
> Robert
> 
> ------------------------------------------------------------------------
> *From:* Luis Ibanez [mailto:luis.ibanez at kitware.com]
> *Sent:* Wed 25/05/2005 22:03
> *To:* Atwood, Robert C
> *Cc:* insight-users at itk.org
> *Subject:* Re: [Insight-users] Isosurface using a different image pixel 
> type? Baffled by generic programming.
> 
> 
> Hi Robet,
> 
> 
> It is indeed very easy.
> 
> Simply pass your image through the ThresholdImageFilter
> nd generate the binary image that the BinaryMask3DMeshSource needs.
> 
> For details, look at the ITK Software Guide
> 
> 
>              http://www.itk.org/ItkSoftwareGuide.pdf
> 
> 
> Section 6.1, pdf-page 165.
> 
> 
>         Regards,
> 
> 
>            Luis
> 
> 
> 
> ------------------------
> Atwood, Robert C wrote:
> 
>  > This should be easy. I only wanted to change the example
>  > Examples/Filtering/IsoSurfaceExtraction.cxx , as described in Section
>  > 6.10.1 of the Users Guide (draft), so that the input image is a
>  > different type. Since it seems like everything is templated from
>  > PixelType, I would have thought that through the mechanism of Generic
>  > Programming , I could change this eg. to unsigned char, and recompile.
>  > However, this does not work, seemingly because BinaryMask3DMeshSource is
>  > not templated over the image type, but has a built in image type of
>  > <unsigned short , 3>.  I don't see this mentioned in the User Guide or
>  > in the code for the example. Only the collaboration diagram from the
>  > Doxygen clarifies why my program (derived from the example by changing
>  > one line) does not compile. 
>  > 
>  > How should I get the image (pixel) type into the BinaryMask3DMEshSOurce
>  > class ??
>  > 
>  > Robert
>  > 
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  > _______________________________________________
>  > Insight-users mailing list
>  > Insight-users at itk.org
>  > http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 





More information about the Insight-users mailing list