[Insight-users] New questions

Luis Ibanez luis . ibanez at kitware . com
Sat, 06 Dec 2003 15:10:12 -0500


Hi Radhika,

1) The methods for setting the inputs for the MaskImageFilter are
    SetInput1() and SetInput2() as in any other filter deriving
    from the BinaryFunctorImageFilter.
 
http://www . itk . org/Insight/Doxygen/html/classitk_1_1BinaryFunctorImageFilter . html

    Their usage in the MaskImageFilter is as follows:

       SetInput1() is used to set the image
       SetInput2() is used to set the mask.


2) First apply the mask, then take the output of the MaskImageFilter
    and pass it other filters. for example, the mean of the output image
    can be computed with the MeanCalculator. In the middle you can setup
    the ScalarImageToListAdaptor.
 
http://www . itk . org/Insight/Doxygen/html/classitk_1_1Statistics_1_1MeanCalculator . html
http://www . itk . org/Insight/Doxygen/html/classitk_1_1Statistics_1_1ScalarImageToListAdaptor . html


3) By the "list of voxels",
    do you mean the list of "Indices" or the list of "grayscale" values ?

    If you actually want to do this as the last part of your processing,
    you can simply put together two ImageConstRegionIteratorWithIndex

http://www . itk . org/Insight/Doxygen/html/classitk_1_1ImageRegionConstIteratorWithIndex . html

    Something like:

    typedef itk::Image<unsigned char, 3>   MaskType;
    typedef itk::Image<float, 3>           ImageType;

    typedef
        itk::ImageRegionConstIteratorWithIndex<
                                  MaskType > MaskIteratorType;

    typedef
        itk::ImageRegionConstIteratorWithIndex<
                                  ImageType > ImageIteratorType;

    ImageType::Pointer  image = GetImageSomehow();
    MaskType::Pointer   mask  = GetMaskSomehow();

   ImageType::RegionType region = image->GetBufferedRegion();

   ImageIteratorType imit( image, region );
   MaskIteratorType  mkit( mask,  region );

   imit.GoToBegin();
   mkit.GoToBegin();

   while( ! imit.IsAtEnd() && ! mkit.IsAtEnd() )
     {
     if( mkit.Get() != 0 )   // if mask pixel is on
        {
        std::cout << "pixel value " << std::endl;
        std::cout << imit.Get()      << std::endl;
        std::cout << "pixel index " << std::endl;
        std::cout << imit.GetIndex() << std::endl;
        }
     ++imit;
     ++mkit;
     }



4)  If you want to do connected components, simply use
     the connected components filter   :-)

http://www . itk . org/Insight/Doxygen/html/classitk_1_1ConnectedComponentImageFilter . html

      If you want the labels to have consecutive numerical values
      use the RelabelComponentImageFilter
http://www . itk . org/Insight/Doxygen/html/classitk_1_1RelabelComponentImageFilter . html

      If you want to get the largest component, use the
      ScalarImageToHistogramGenerator and pass the output of the
      connected components filter.
http://www . itk . org/Insight/Doxygen/html/classitk_1_1Statistics_1_1ScalarImageToHistogramGenerator . html
      An example on the use of this generator is available in

      Insight/Examples/Statistics/ImageHistogram2.cxx


      If you want to compare two components....well.. it depends
      what do you want to compare:

               -  their size in pixels ?
               -  their mean intensity ?
               -  the length of their boundaries ?...



Regards,



    Luis


---------------------------------
Radhika Sivaramakrishna wrote:

> Hi,
> 
> I also had the following questions and thought I would send them out 
> right now.
> 
>  
> 
>    1. For MaskImageFilter, what are the member functions to set the
>       input image and mask. Are they SetInput1 and SetInput2 or SetInput
>       and SetMask?
>    2. Also, given a grey scale image and a mask, I want to perform
>       operations only on pixels in the grayscale image which are within
>       mask. For example I
> 
>        want to find mean of the image only in region of mask. How do I 
> do this?
> 
>    3. Is there a way to get the list of voxels belonging to the mask?
> 
>  
> 
>    4. I have binary images with multiple objects. I want to be able to
>       label these and perform other operations like
> 
>  
> 
>          1. Extracting largest connected component
>          2. Comparing one component to other
> 
>  
> 
> Your help is appreciated.
> 
> Thanks
> 
> Radhika
> 
>  
> 
> -----------------------------------------------------
> 
> Confidentiality Notice.
> 
> This email message is for the sole use of the intended recipient(s) and 
> may contain confidential and privileged information. Any unauthorized 
> review, use, disclosure or distribution is prohibited. If you are not 
> the intended recipient, please contact the sender by reply email and 
> destroy all copies of the original message. If you are the intended 
> recipient, please be advised that the content of this message is subject 
> to access, review and disclosure by the sender's Email System Administrator.
>