[Insight-users] ROI Image filter

Bill Lorensen bill.lorensen at gmail.com
Mon Dec 15 08:40:01 EST 2008


Do the roifilter->Update() before you request the size.

2008/12/15 TienGarry <gjtian at hotmail.com>:
>
> I want to process the image volume slice by slice, so I use
> RegionOfInterestImageFilter to extract one slice from the volume as
> following:
>
> OutputImageType::SizeType size =
> filter->GetOutput()->GetLargestPossibleRegion().GetSize();
>     unsigned short slicenum = size[2];
>     OutputImageType::IndexType start =
> filter->GetOutput()->GetLargestPossibleRegion().GetIndex();
>     typedef itk::RegionOfInterestImageFilter< OutputImageType,
>         OutputImageType > ROIFilterType;
>     ROIFilterType::Pointer roifilter = ROIFilterType::New();
>     for ( unsigned short i = 0; i < slicenum; i++ )
>     {
>         start[2] = i;
>         size[2] = 1;
>         OutputImageType::RegionType desiredRegion;
>         desiredRegion.SetSize(  size  );
>         desiredRegion.SetIndex( start );
>         roifilter->SetRegionOfInterest( desiredRegion );
>         roifilter->SetInput(filter->GetOutput());
>         OutputImageType::SizeType roisize =
> roifilter->GetOutput()->GetLargestPossibleRegion().GetSize();
>         roifilter->Update();
> }
>
> But, I got roisize=[0,0,0], Anyone can help me?
> Thx.
>
>
> ________________________________
> MSN热搜榜全新升级,更多排行榜等着你! 立即查看!
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list