[Insight-users] question ? [MaskImageFilter]

agatte wiatrak11 at poczta.onet.pl
Wed Feb 15 05:28:47 EST 2012


Hi,


I have a problem with MaskImageFilter. I'm trying to apply example from itk
wiki but I received an error 

1>..\source\MultiplyImageFilter.cxx(106) : error C2039: 'SetMaskImage' : is
not a member of 'itk::MaskImageFilter<TInputImage,TMaskImage>'





// Def typ pixela
typedef signed short PixelType;
// Def wymiar
const unsigned int ImageDim = 2;
// Def Typ obrazu
typedef itk::Image<PixelType,ImageDim> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::ImageFileWriter<ImageType> WriterType;



void CreateHalfMask(ImageType::Pointer image, ImageType::Pointer &mask)
{
  ImageType::RegionType region = image->GetLargestPossibleRegion();
 
  mask->SetRegions(region);
  mask->Allocate();
 
  ImageType::SizeType regionSize = region.GetSize();
 
  itk::ImageRegionIterator<ImageType> imageIterator(mask,region);
 
  while(!imageIterator.IsAtEnd())
  {
    if(imageIterator.GetIndex()[0] > regionSize[0] / 2)
        {
        imageIterator.Set(0);
        }
      else
        {
        imageIterator.Set(255);
        }
 
    ++imageIterator;
  }
 
}

int main()
{
 		
        ReaderType::Pointer reader1 = ReaderType::New();
		std::string plik1 = "IMG00069.dcm";
        reader1->SetFileName(plik1);
        reader1->Update(); 
        std::cout << reader1<< std::endl;


		ReaderType::Pointer reader2 = ReaderType::New();
		std::string plik2 = "IMG00069.dcm";
        reader2->SetFileName(plik2);
        reader2->Update(); 
        std::cout << reader2<< std::endl;

		ImageType::Pointer mask = ImageType::New();
		CreateHalfMask(reader1->GetOutput(), mask);

		typedef itk::MaskImageFilter< ImageType, ImageType > MaskFilterType;
        MaskFilterType::Pointer maskFilter = MaskFilterType::New();
        maskFilter->SetInput(reader1->GetOutput());
        maskFilter->SetMaskImage(mask);  // here ? 
		maskFilter->Update();

		WriterType::Pointer writerMask = WriterType::New();
        writerMask->SetInput(maskFilter->GetOutput() );
        writerMask->SetFileName("maskFilter-13-02-2012.dcm");
        writerMask->Update();

        typedef itk::MultiplyImageFilter <ImageType, ImageType >
MultiplyImageFilterType;
        MultiplyImageFilterType::Pointer multiplyFilter =
MultiplyImageFilterType::New();
        multiplyFilter->SetInput1(mask);
        multiplyFilter->SetInput2(reader2->GetOutput());
		itk::SimpleFilterWatcher watcherMulti(multiplyFilter,"MultiFilter");
		multiplyFilter->Update();

		WriterType::Pointer writer = WriterType::New();
        writer->SetInput(multiplyFilter->GetOutput() );
        writer->SetFileName("multifilter-13-02-2012.dcm");
        writer->Update();

	  return EXIT_SUCCESS;

}

I would  appreciate  for any help, please.


Best,
agatte




 
-- 
View this message in context: http://old.nabble.com/question----MaskImageFilter--tp33327702p33327702.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list