[Rtk-users] Reconstructed Slice save as tiff

Chao Wu wuchao04 at gmail.com
Wed May 4 08:44:37 EDT 2016


A small add-on (copied from ITK document):

ExtractImageFilter also collapses dimensions so that the input image may
have more dimensions than the output image (i.e. 4-D input image to a 3-D
output image). To specify what dimensions to collapse, the ExtractionRegion
must be specified. For any dimension dim where ExtractionRegion.Size[dim] =
0, that dimension is collapsed. The index to collapse on is specified by
ExtractionRegion.Index[dim]. For example, we have a image 4D = a 4x4x4x4
image, and we want to get a 3D image, 3D = a 4x4x4 image, specified as
[x,y,z,2] from 4D (i.e. the 3rd "time" slice from 4D). The
ExtractionRegion.Size = [4,4,4,0] and ExtractionRegion.Index = [0,0,0,2].

Regards,
Chao

2016-05-04 13:27 GMT+02:00 Cyril Mory <cyril.mory at uclouvain.be>:

> Hi Amjad,
>
> You can use an ITK extract filter to extract a region that corresponds to
> one of your slices (along the axis you want). The  output of the extract
> filter will be 3D, so you will need to cast it into a 2D images using an
> ITK cast filter.
>
> Cyril
>
>
> On 05/04/2016 11:04 AM, AMJAD N wrote:
>
> Hi all,
>
> I have wrote code for saving output volume stack as *.tiff. Currently I am
> getting output of XY axis. What should I do in order to get the other axes.
> My code is shown below.
>
>         typedef itk::StreamingImageFilter<FloatImageType, FloatImageType>
> StreamerType;
> StreamerType::Pointer streamerBP = StreamerType::New();
> streamerBP->SetInput(feldkampCUDA->GetOutput());
> streamerBP->SetNumberOfStreamDivisions(8);
>
> typedef itk::Image< float, 2 >     Image2DType;
> typedef itk::ImageSeriesWriter< FloatImageType, Image2DType > WriterType;
> WriterType::Pointer writer = WriterType::New();
> writer->SetInput(streamerBP->GetOutput());
>
> typedef itk::NumericSeriesFileNames    NameGeneratorType;
> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
> nameGenerator->SetSeriesFormat("Reconstructed_%06d.tif");
> nameGenerator->SetStartIndex(0);
> nameGenerator->SetEndIndex(sizeOutput[2] - 1); // sizeOutput[2] is the
> Z-axis value of //reconstructed volume
> nameGenerator->SetIncrementIndex(1);
> writer->SetFileNames(nameGenerator->GetFileNames());
> writer->SetUseCompression(true);
> writer->Update();
>
> PS: My reconstruction works fine.
>
> Thanks and Regards
>
> AMJAD N
>
>
>
> _______________________________________________
> Rtk-users mailing listRtk-users at public.kitware.comhttp://public.kitware.com/mailman/listinfo/rtk-users
>
>
>
> _______________________________________________
> Rtk-users mailing list
> Rtk-users at public.kitware.com
> http://public.kitware.com/mailman/listinfo/rtk-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20160504/24534997/attachment-0010.html>


More information about the Rtk-users mailing list