[Insight-users] 2D Slice to 3D Volume

Dário Oliveira dariodisk at gmail.com
Sat Sep 8 11:26:25 EDT 2007


Hi Luis,

thank you for your reply.

Yes, I'm using the PasteImageFilter and I've tried two different approaches:

1. To define the filter with an 2D image as source and a 3D image as the
other input, just like that:
*
typedef* itk::PasteImageFilter< 3DImageType, 2DImageType, 3DImageType >
FilterTypeP;
FilterTypeP::Pointer filterP = FilterTypeP::New();

filterP->SetDestinationImage(image3D);
filterP->SetInput(image3D);

*for* (*int* i=0; i<numSlices; i++)
{
 {some processing using the ith slice}
 filterP->SetSourceImage(filter2D->GetOutput());
 filterP->SetDestinationIndex(start);
 filterP->SetSourceRegion(filter2D->GetOutput
()->GetLargestPossibleRegion());
 filterP->*Update*();
}
In that approach I got a compile error.

2. So I changed my approach using a cast image filter, like that:

*typedef* itk::CastImageFilter < 2DImageType, 3DImageType > FilterTypeCA;
FilterTypeCA::Pointer filterCast = FilterTypeCA::New();

*typedef* itk::PasteImageFilter< 3DImageType, 3DImageType, 3DImageType >
FilterTypeP;
FilterTypeP::Pointer filterP = FilterTypeP::New();

3DImageType::RegionType outputRegion = image->GetLargestPossibleRegion();
3DImageType::SizeType size2 = outputRegion.GetSize();
3DImageType::IndexType start = outputRegion.GetIndex();
size2[2] = 1;
outputRegion.SetSize( size2 );

filterP->SetDestinationImage(image);
filterP->SetInput(image);

*for* (*int* i=0; i<numSlices; i++)
{
 {some processing using the ith slice}
 start[2] = i;
 filter2D->*Update*();
 filterCast->SetInput(filter2D->GetOutput());
 filterCast->*Update*();
 outputRegion = filterCast->GetOutput()->GetLargestPossibleRegion();
 outputRegion.SetIndex( start );
 filterP->SetSourceImage(filterCast->GetOutput());
 filterP->SetDestinationIndex(start);
 filterP->SetSourceRegion(outputRegion);
 filterP->*Update*();
}

In this case I got a runtime error in "filterP->*Update*();"

I've just started to work with ITK, so I'm probably making some silly
mistake.

Thank you!

Dário Olivera.
2007/9/8, Luis Ibanez <luis.ibanez at kitware.com>:
>
>
>
> Hi Dario,
>
> 1) Are you using the "PasteImageFilter" ?
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1PasteImageFilter.html
>
>
> 2) When you say that "it doesn't seem to work" ?
>    Do you mean that
>
>    a) It doesn't compile ?
>    b) It doesn't link ?
>    c) It produces a segmentation fault at run time ?
>    d) It throws an exception at run time ?
>    e) It produces an image that when you visualize
>       doesn't have the content that you expect ?
>
>
> 3) Could you post to the list the minimal example of your code ?
>
>
>
>    Thanks
>
>
>       Luis
>
>
>
> -----------------------
> Dário Oliveira wrote:
> > Hi friends,
> >
> > I'm having trouble to paste (actually replace) a processed 2D slice into
> > its original volume. I've read some previous itk-users email in the
> > mailing list, but I still couldn't manage to suceed. Is there any simple
> > way to perfom this task?
> >
> > I'm trying to cast the processed 2D image to a 3D one, and get its 3D
> > region to paste into the original 3D volume, but it doesn't seem to
> work.
> >
> > Any help will be very apreciated,
> >
> > Regards
> > --
> > Dário Oliveira
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>



-- 
Dário Oliveira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070908/92797ed7/attachment.htm


More information about the Insight-users mailing list