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

David Gobbi david.gobbi at gmail.com
Fri Jul 28 13:18:40 EDT 2017


Hi Zhang,

Please CC the vtkusers list in your replies!  Also please use proper
capitalization and punctuation, otherwise I will simply ignore your emails.

In order to average slices to reduce noise, use this vtkImageReslice method:

    resliceFilter->SetSlabNumberOfSlices(N);

where N is the number of slices you want to be averaged.  So, to average
over 10mm when the slices have 0.4mm spacing, use N=25.  The output slice
spacing will still be 0.4mm.

The documentation for all the "Slab" methods for vtkImageReslice starts
here:
http://www.vtk.org/doc/nightly/html/classvtkImageReslice.html#ac46cc094b1fb577d2a3983fa2f90350d

 - David


On Fri, Jul 28, 2017 at 10:46 AM, zhang07101 at 126.com <zhang07101 at 126.com>
wrote:

> dear david
>
> for example, if the thickness of image is 0, the image may have lots of
> noise. if the.thickness of image is 10mm, the image will look more smooth.
> i want the thickness of resliced image to be 10mm, which will make the
> image more smooth. can i set the thickness for the resliced image.
>
> zhang qiang
>
>
> -------- 原始邮件 --------
> 主题:Re: [vtkusers] How to understand the slab thickness, slab resolution,
> spacing
> 发件人:David Gobbi
> 收件人:zhang07101 at 126.com,VTK Users
> 抄送:
>
>
>
> Hi Zhang,
>
> Please explain exactly what you mean by "thickness".  Usually only the
> spacing is needed for reslicing, so you need to help me understand why your
> situation is different.
>
> Also, always CC your replies to the VTK users list.
>
>  - David
>
>
> On Fri, Jul 28, 2017 at 9:19 AM, zhang07101 at 126.com <zhang07101 at 126.com>
> wrote:
>
>> Dear David
>>
>> because i need to set the thickness in the resliced image, and
>> vtkimagereslice can not set the thickness. vtkimageslabreslice may have
>> function to set thickness for the resliced image. so i need to know what is
>> the meaning of slab.
>>
>> zhang qiang
>>
>>
>> -------- 原始邮件 --------
>> 主题:Re: [vtkusers] How to understand the slab thickness, slab resolution,
>> spacing
>> 发件人:David Gobbi
>> 收件人:zhang qiang
>> 抄送:VTK Users
>>
>>
>> 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/6fd03562/attachment.html>


More information about the vtkusers mailing list