ITK/Best of the List: Difference between revisions

From KitwarePublic
< ITK
Jump to navigationJump to search
m (Reverted edits by YzpVdv (Talk); changed back to last version by Zack)
Line 107: Line 107:


  template <class InputPixelType>
  template <class InputPixelType>
  class InvertIntensityFunctor
  struct InvertIntensityFunctor
  {
  {
public:
&nbsp;
     InputPixelType operator()( InputPixelType input )
     InputPixelType operator()( InputPixelType input )
         {
         {

Revision as of 03:57, 7 June 2011

This is a collection of some of the most useful posts to the InsightUsers mailing list.

Setting up WinCVS

You don't need to add `:pserver` to the `CVSROOT` text box in WinCVS.

Simply go to "Admin" --> "Preferences", a popup window will appear containing several tabs. Take "General", then

  • in "Authentication", choose `pserver`
  • in "Path" set `/cvsroot/Insight`
  • in Host address set `www.itk.org`
  • in User name set `anoncvs`

WinCVS will compose the `CVSROOT` entry for you. The CVSROOT entry will look like:

anoncvs@www.itk.org:/cvsroot/Insight

at that point you can go to "Admin" --> "Login".

Note that WinCVS also allows you to write the classical comman line invokation. If you prefer this, just go to "Admin" --> "Command line".

(Luis Ibanez, original post, 15 May 2004)

Combining Images

JoinImageFilter is designed to combine two input images into a single output vector image. For instance, you can give it two scalar images as input and the output will be have a vector at each pixel with two components. Or you can give it a scalar image and a vector image and the output will be a vector image. The "join" is in analagous to a database "join" query.

I think you will need to use the PasteImageFilter. To do what you want, you will need to create an image that is the size of your two image sets combined, the run through two PasteImageFilters to paste the first image in the first part of the result and then a second PasteImageFilter to past the second image into the second part of the result.

I have been meaning to put together an AppendImageFilter that will take two stacks of images and create a single image that has the two datasets appended along a designated axis.

(Jim Miller, original, March 2004)

Tutorial: Segmenting Ventricles

Here are the parameters that you can use with the `GeodesicActiveContourSegmentation` application (in InsightApplications), in order to segment the ventricles from one of the BrainWeb datasets.

1. Load the BrainWeb image:

        `brainweb1e1a10f20.mha`

2. In FastMarching

   1. Set the distance to 3.0
   2. Set Stopping value = 10.0

3. In Gradient magnitude keep sigma = 1.2

4. In Sigmoid keep alpha = -1, beta= 5.0

5. In GeodesicActive contour do:

   1. RMS error  = 0.01
   2. Iterations = 200
   3. Curvature scaling   =  1.0
   4. Propagation scaling = 20.0
   5. Advection scaling   = 20.0

6. Place seed point at locations (or close to them)

   1.   ( 67,  87,  87)
   2.   (113,  87,  87)
   3.   ( 85, 135,  87)
   4.   ( 95, 135,  87)
   5.   ( 78, 108,  97)
   6.   (101, 108,  97)

The reason why you may be getting always a sphere is that the weight of propagation and advection terms are too low in your case, so the front is not moving enough.

The VTK visualization button is something that was never finished in this application. So it is normal (although it is not good) that the displayed window is all white.

If you really want to see a volume rendering of the resulting segmentation, is is much easier now to use VolView and its ITK Geodesic Active Contour plugin. You can download the free version of VolView from:

(Luis Ibanez, original post, 7 April 2004)

Adding Noise to Images

It is frequently useful to add different types of noise to images, for the purposes of validation and testing. You can use the Random image source in order to generate a pure noise image. Then use the AddImageFilter in order to add the noise to an input image, for simulating "additive" noise.

You could use the MultiplyImageFilter for simulating multiplicative noise.

You can also use classes from the Statistics framework as noise generators. Please look at the SoftwareGuide in Section 10.2.7, pdf-page 462.

You will find a detailed description of ITK denoising (or smoothing) filters in the software guide Section 6.5, pdf-page 167 to 197.

(Luis Ibanez, original post, December 2003)

Invert Image Intensity

There is not currently a filter to invert the intensity of an image (ie. make a negative). This example nicely illustrates the use of image functors, and how easy it is to extend ITK with only a little code.

First we define a functor class that is applied to each pixel in the image:

template <class InputPixelType>
struct InvertIntensityFunctor
{
   InputPixelType operator()( InputPixelType input )
       {
           return NumericTraits<InputPixelType>::max() - input;
       }
};

Then we declare a unary functor with the inverter as a parameter, thus:

   typedef itk::UnaryFunctorImageFilter<
       InputImageType,
       InputImageType,
       InvertIntensityFunctor<typename InputImageType::PixelType> >
           InverterType;

You can then insert this image filter into your pipeline just like any other image filter.

(From insight-users... where?)



ITK: [Welcome | Site Map]