[Insight-users] Problems with PasteImageFilter

doege at zedat.fu-berlin.de doege at zedat.fu-berlin.de
Fri May 22 06:45:49 EDT 2009


Hello,

I got problems with using the PasteImageFilter. I am trying to put 3d
images(128x128x1) into a 3d image(128x128x92).
But it in the end it shows only on slice in my 3d image. I think I somehow
have to call "darkGroundImage" but don´t know how to do it.

I tried:
bufferImage=&darkGroundImage;
error C2440: '=' : cannot convert from 'itk::SmartPointer<TObjectType> *'
to 'itk::Image<TPixel,VImageDimension> *'

bufferImage=*darkGroundImage;
error C2440: '=' : cannot convert from itk::Image<TPixel,VImageDimension>'
to 'itk::Image<TPixel,VImageDimension> *'

Thanks,
Juliane
-------------------------------------
part of my my code:


		//convert 3D Image to 2D Slices
        InputImageType::RegionType desiredRegion;
        InternalImageType::SizeType size;
        unsigned int sliceNumber = 0;
	x = castImage ->GetLargestPossibleRegion().GetSize()[0];
	y = castImage ->GetLargestPossibleRegion().GetSize()[1];
	z = castImage ->GetLargestPossibleRegion().GetSize()[2];
	size[0]= x;
        size[1]= y;
        size[2] = z; //z-axis
InputImageType::IndexType
start=castImage->GetLargestPossibleRegion().GetIndex();
        //initalize image
		InternalImageType::RegionType region;
		region.SetSize( size );
		region.SetIndex( start );
		//darkGroundImage ist buffer of new 3d image
		InternalImageType::Pointer darkGroundImage = InternalImageType::New();
		itk::Image<InternalPixelType, VImageDimension>* bufferImage;
		darkGroundImage ->SetLargestPossibleRegion(region);
		darkGroundImage ->SetBufferedRegion(region);
		darkGroundImage ->SetRequestedRegion(region);
		darkGroundImage->Allocate();

		size[2] = 0;//collapse 3D to 2D

		for(int i = 0; i<z ; i++){

			start[2] = i;//z-axis of the image index
			desiredRegion.SetSize( size ); //size of the image
			desiredRegion.SetIndex( start ); //index where to put the image
			//posBorderImage from 3d to 2d slices
			extractSliceFilterPosImage -> SetExtractionRegion( desiredRegion );
			extractSliceFilterPosImage -> SetInput(posBorderImage); //posBorderImage
			extractSliceFilterPosImage->Update();

			//just a test filter
			sobelFilter->SetInput(extractSliceFilterPosImage->GetOutput());
			sobelFilter->Update();

			//cast 2d to 3d
			castImage2Dto3DFilter->SetInput(sobelFilter->GetOutput());
			castImage2Dto3DFilter->Update();

			start[2] = i;
			pasteImageFilter-> SetDestinationIndex(start);
			pasteImageFilter-> SetSourceRegion(size);
			pasteImageFilter-> SetInput(castImage2Dto3DFilter->GetOutput());
			pasteImageFilter-> SetSourceImage(darkGroundImage);
			pasteImageFilter->Update();
			pasteImageFilter->GetOutput();
			std::cout<< "i paste: " <<i<<std::endl;
        }

       		darkGroundImage->Update();
		bufferImage =pasteImageFilter->GetOutput();
		//bufferImage=&darkGroundImage; // doesn´t work


	  // add output of RegionGrower to tree
	  mitk::DataTreePreOrderIterator it(step6->m_Tree);
	  step6->m_ResultNode =
mitk::DataTreeHelper::AddItkImageToDataTree(bufferImage, &it,
"segmentation");
	  step6->m_ResultImage =
static_cast<mitk::Image*>(step6->m_ResultNode->GetData());



More information about the Insight-users mailing list