ITK/Tutorials/DOs and DONTs: Difference between revisions

From KitwarePublic
< ITK‎ | Tutorials
Jump to navigationJump to search
(New page: == PipeLine == * Do call Update() before using the pipeline output! == Image Creation == * On a New()'ly -manually-created image, do initialize the pixel values if you expect them to be s...)
 
No edit summary
Line 1: Line 1:
== PipeLine ==
* Do call Update() before using the pipeline output!


== Image Creation ==
= PipeLine =
* On a New()'ly -manually-created image, do initialize the pixel values if you expect them to be so!
 
== DO ==
 
* Do call Update() before using the pipeline output
 
 
= Image Creation =
 
== DO ==
 
* On a newly-manually-created image, do initialize the pixel values if you expect them to be so!
** Example: image->FillBuffer(0); // initialize it to all dark
** Example: image->FillBuffer(0); // initialize it to all dark
** ITK doesn't initialize the image buffer when you call Allocate(). It is your responsibility to initialize the pixel values.
= Coding Style =
== DO NOT ==


== Coding Style ==
* Do not declare constanst using
* Beware of #define CONST_VALUE_NAME 3
** #define CONST_VALUE_NAME 3
** If itk is using CONST_VALUE_NAME somewhere, your compile-time (& frustration) could grow unreasonably until you find what is hidden behind some long forgotten #define in a long-forgotten .h. Example:
** Use instead
*** #define Dimension 2
*** const unsigned int CONST_VALUE_NAME = 3, 
*** #include itkTooManyFilesToList.h
* ITK doesn't define constants with  #defines in header files

Revision as of 13:57, 7 July 2009

PipeLine

DO

  • Do call Update() before using the pipeline output


Image Creation

DO

  • On a newly-manually-created image, do initialize the pixel values if you expect them to be so!
    • Example: image->FillBuffer(0); // initialize it to all dark
    • ITK doesn't initialize the image buffer when you call Allocate(). It is your responsibility to initialize the pixel values.

Coding Style

DO NOT

  • Do not declare constanst using
    • #define CONST_VALUE_NAME 3
    • Use instead
      • const unsigned int CONST_VALUE_NAME = 3,
  • ITK doesn't define constants with #defines in header files