[vtkusers] How to understand the slab thickness, slab resolution, spacing

David Gobbi david.gobbi at gmail.com
Fri Jul 28 10:53:49 EDT 2017


Hi Zhang,

To make your data isotropic, I suggest using vtkImageReslice.  I don't see
any reason to use vtkImageSlabReslice, but maybe you can explain in more
detail why the "slab" part is important for your result.

VTK does not record the SliceThickness.  The VTK spacing measures the
distance from the center of one slice to the center of the next slice.  If
you need the thickness, you must get it from the DICOM metadata (e.g. you
could use the vtkDICOMReader from github.com/dgobbi/vtk-dicom, which reads
all of the metadata).

If you use vtkImageReslice, making the data isotropic should be as easy as
this:

        vtkSmartPointer<vtkImageReslice> resliceFilter = vtkSmartPointer<
vtkImageReslice>::New();
        resliceFilter->SetInputData(originalData);
        resliceFilter->SetOutputSpacing(0.4,0.4,0.4);
        resliceFilter->SetInterpolationModeToLinear();
        resliceFilter->Update();

There is no need to call resliceFilter->SetOutputDimensionality(3), since
this is already the default.

 - David


On Fri, Jul 28, 2017 at 1:32 AM, zhang qiang <zhang07101 at 126.com> wrote:

> Dear all
>
>     I feel confused about some concepts about VTK. Currently, I need to
> reslice a 3D data to make the data isotropic, and I use
> vtkImageSlabReslice.
>
>     Firstly, I read the data, the code is :
>
> vtkSmartPointer<vtkDICOMImageReader> reader =
> vtkSmartPointer<vtkDICOMImageReader>::New();
>
> reader->SetDirectoryName("G:\\SNAP_Signal_Analysis\\snap_sim
> ulation\\SNAP_TOF_Data\\Chang
> Cheng\\TOF");
>         reader->Update();
>
>         vtkSmartPointer<vtkImageData> originalData = reader->GetOutput();
>         int originalDims[3];
>         double originalSpacing[3];
>         originalData->GetDimensions(originalDims);
>         originalData->GetSpacing(originalSpacing);
>
>     My question is: how does the originalData record the data thickness
> information? Because I can not find the thickness from originalData.
>
>     Then, I reslice the data by the following code:
>
>     vtkSmartPointer<vtkImageSlabReslice> resliceFilter =
> vtkSmartPointer<vtkImageSlabReslice>::New();
>         resliceFilter->SetInputData(originalData);
>         resliceFilter->SetOutputSpacing(0.4,0.4,0.4);
>         //resliceFilter->SetSlabResolution(0.4);
>         resliceFilter->SetInterpolationModeToLinear();
>         resliceFilter->SetOutputDimensionality(3);
>         resliceFilter->Update();
>
>     Then, I check the output by:
>
>     vtkSmartPointer<vtkImageData> reslicedData =
> resliceFilter->GetOutput();
>         int reslicedDims[3];
>         double reslicedSpacing[3];
>         reslicedData->GetDimensions(reslicedDims);
>         reslicedData->GetSpacing(reslicedSpacing);
>
>      I find that the resliceFilter->SetSlabResolution is critical to get
> the
> correct pixel spacing. Without the resliceFilter->SetSlabResolution, the
> reslicedSpacing is (0.4,0.4,1), which means the SetOutputSpacing do not
> work. In the SetOutputSpacing(spacing[0],spaicng[1],spacing[3]), what's
> the
> meaning of spacing[3]? It is the thickness, or it is the spacing between
> slice?
>
>      Through dicom viewer, I refer to the dicom header, and I am sure that
> originalSpacing[3] is the spacing between slice. So, Why
> resliceFilter->SetOutputSpacing(0.4,0.4,0.4) do not make
> reslicedSpacing[3]=0.4?
>
>      In addition, I find two function in vtkImageSlabReslice:
> SetSlabThickness and SetSlabResolution. From some explanation from
> Internet,
> I guess that SetSlabThickness *NumBlendSamplePoints=SetSlabResolution.
> But,
> after test some case, I find it is wrong. And I have no idea about what is
> the relationship between slab thickness and slab resolution.
>
> zhang qiang
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170728/67c6de8e/attachment.html>


More information about the vtkusers mailing list