[vtkusers] What ditermines whether the slice order should be reversed?

David Gobbi david.gobbi at gmail.com
Tue Aug 29 20:22:31 EDT 2017


On Tue, Aug 29, 2017 at 6:05 PM, Liu_tj <tjlp at netease.com> wrote:

> Hi,David,
>
> 2 questions come up.
>
> 1. If I call reader->SetMemoryRowOrderToFileNative() before update()
> method, do I still need to use vtkDICOMToRAS?
>

Yes, if you are using vtkImageViewer (or vtkImageViewer2).  If you do not
use vtkDICOMToRAS, then vtkImageViewer will show the image upside-down.



> 2. If I update to the latest vtk-dicom version, do I still need to use
> reader->SetMemoryRowOrderToFileNative() and vtkDICOMToRAS?


No.  Again, I'm assuming that you are using vtkImageViewer2.

 - David




> 在2017-08-29,"David Gobbi" <david.gobbi at gmail.com> 写道:
>
> -----原始邮件-----
> *发件人:*"David Gobbi" <david.gobbi at gmail.com>
> *发送时间:*2017年08月29日 星期二
> *收件人:*"Liu_tj" <tjlp at netease.com>
> *抄送:*"vtkusers" <vtkusers at vtk.org>
> *主题:*Re: Re: Re: Re: What ditermines whether the slice order should be
> reversed?
>
>
> Hi Liu Peng,
>
> If you apply vtkImageFlip to the image, then the matrix returned by
> reader->GetPatientMatrix() will not work with the image.  I recommend that,
> at the very least, you try doing the following instead:
>
> 1) use reader->SetMemoryRowOrderToFileNative(), and
> 2) try using vtkDICOMToRAS instead of vtkImageFlip:
>  https://github.com/dgobbi/vtk-dicom/blob/master/Source/vtkDICOMToRAS.h
>
> Also, if possible, update to the latest version of vtk-dicom.
>
> Cheers,
>  - David
>
> On Tue, Aug 29, 2017 at 1:58 AM, Liu_tj <tjlp at netease.com> wrote:
>
>> Hi, David,
>>
>> Actually in my current code I use vtkImageFlip to flip the image data to
>> solve the slice display orientation issue on coronal and saggital view as
>> follow:
>>
>>         vtkDICOMReader* reader = vtkDICOMReader::New();
>>         reader->SetFileNames(vtkDICOMFilePaths);
>>         reader->Update();
>>         vtkImageFlip* flip = vtkImageFlip::New();
>>         flip->SetInputConnection(reader->GetOutputPort());
>>         flip->SetFilteredAxis(2);
>>         flip->Update();
>>         vtkImageData* imageData = flip->GetOutput();
>>
>> Thanks
>> Liu Peng
>>
>> 在2017-08-29,"David Gobbi" <david.gobbi at gmail.com> 写道:
>>
>> -----原始邮件-----
>> *发件人:*"David Gobbi" <david.gobbi at gmail.com>
>> *发送时间:*2017年08月29日 星期二
>> *收件人:*"Liu_tj" <tjlp at netease.com>
>> *抄送:*"vtkusers" <vtkusers at vtk.org>
>> *主题:*Re: Re: Re: What ditermines whether the slice order should be
>> reversed?
>>
>>
>> Hi Liu Peng,
>>
>> For vtk-dicom, that would actually be version 0.7.1 (the current version
>> is 0.8.5).
>>
>> It is possible that you have run into this bug, which was fixed in 0.8.3:
>> https://github.com/dgobbi/vtk-dicom/issues/132
>> The work-around for the bug is reader->SetMemoryRowOrderToFileNative().  See
>> here for more info:
>> http://dgobbi.github.io/vtk-dicom/doc/api/image_orientation.html
>>
>> Unfortunately, calling SetMemoryRowOrderToFileNative() doesn't work very
>> well with vtkImageViewer or vtkImageViewer2, since these "viewer" classes
>> insist on images that are in "bottom-to-top" order (DICOM images are
>> natively in top-to-bottom order).  However, if you use vtkImageActor or
>> vtkImageSlice to display your images, then you can set the camera so that
>> "up" is in the correct direction.
>>
>> The vtkDICOMReader uses ImageOrientationPatient (0020,0037) and
>> ImagePositionPatient (0020,0032) to put the slices in order.  These
>> attributes are more reliable and more precise than PatientPosition
>> (0018,5100).
>>
>> Cheers,
>>  - David
>>
>>
>>
>>
>> On Mon, Aug 28, 2017 at 7:03 PM, Liu_tj <tjlp at netease.com> wrote:
>>
>>> Hi, David,
>>>
>>> I forgot to mention the verison. The VTK and vtk-DICOM version are both
>>> 7.1
>>>
>>> Thanks
>>> Liu Peng
>>>
>>> 在2017-08-28,"David Gobbi" <david.gobbi at gmail.com> 写道:
>>>
>>> -----原始邮件-----
>>> *发件人:*"David Gobbi" <david.gobbi at gmail.com>
>>> *发送时间:*2017年08月28日 星期一
>>> *收件人:*"Liu_tj" <tjlp at netease.com>
>>> *抄送:*"vtkusers" <vtkusers at vtk.org>
>>> *主题:*Re: Re: What ditermines whether the slice order should be reversed?
>>>
>>>
>>> Hi Liu Peng,
>>>
>>> What versions of VTK and vtk-dicom you are using?
>>>
>>>  - David
>>>
>>> On Mon, Aug 28, 2017 at 12:31 AM, Liu_tj <tjlp at netease.com> wrote:
>>>
>>>> Hi, David,
>>>>
>>>> As far as I know, in the RCS system, the direction of Z axis is from
>>>> foot to head.So by default, the slice order in your dicom reader is
>>>> consistent with the RCS system.When the reader sorts the slices, does it
>>>> consider the Patient Postion tag(0080,5100)? Some doctors might use some
>>>> DICOM tools which the slice order is from head to foot and get used to that.
>>>>
>>>> My code block for load slices is as follow:
>>>>
>>>>        vtkStringArray* vtkDICOMFilePaths = vtkStringArray::New();
>>>>         vtkDICOMFilePaths->SetNumberOfValues(aDICOMFilePaths->Length);
>>>>         for(int i = 0; i < aDICOMFilePaths->Length; i ++)
>>>>         {
>>>>             String^ filePath = aDICOMFilePaths[i];
>>>>             const char* filePathByChars = MDKStringUtility::NStringToCha
>>>> rs(filePath);
>>>>
>>>>             vtkDICOMFilePaths->SetValue(i, filePathByChars);
>>>>         }
>>>>
>>>>         vtkDICOMReader* reader = vtkDICOMReader::New();
>>>>         vtkImageData* imageData = reader->GetOutput();
>>>>
>>>> Thanks
>>>> Liu Peng
>>>> 在2017-08-28,"David Gobbi" <david.gobbi at gmail.com> 写道:
>>>>
>>>> -----原始邮件-----
>>>> *发件人:*"David Gobbi" <david.gobbi at gmail.com>
>>>> *发送时间:*2017年08月28日 星期一
>>>> *收件人:*"Liu_tj" <tjlp at netease.com>
>>>> *抄送:*"vtkusers" <vtkusers at vtk.org>
>>>> *主题:*Re: What ditermines whether the slice order should be reversed?
>>>>
>>>>
>>>> Hi Liu Peng,
>>>>
>>>> The vtkDICOMReader sorts according to the Image Plane Module:
>>>> http://dicom.nema.org/MEDICAL/dicom/current/output/chtml/par
>>>> t03/sect_C.7.6.2.html
>>>> That is, the slices are sorted in a manner such that the VTK image data
>>>> has a right-handed coordinate system (called an RCS in the link above).
>>>>
>>>> Sorting the slices to get an RCS means that sometimes the slices will
>>>> be sorted the same as the InstanceNumber, and sometimes they will be sorted
>>>> opposite to InstanceNumber, depending on the order in which scanner ordered
>>>> the slices.
>>>>
>>>> You can perform the sorting yourself by calling reader->SortingOff().
>>>> If Sorting is Off, the reader will take the slices in the same order as the
>>>> vtkStringArray that you passed to reader->SetFileNames().
>>>>
>>>> If you send me the block of code where you set up and call the reader,
>>>> then I might be able to provide more help.  Don't forget to also say what
>>>> versions of VTK and vtk-dicom you are using.
>>>>
>>>> Cheers,
>>>>  - David
>>>>
>>>>
>>>>
>>>> On Sun, Aug 27, 2017 at 10:41 AM, Liu_tj <tjlp at netease.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have a question about the DICOM slice order. I use the DICOM reader
>>>>> by David Gobbi to read the slice series to vtkImageData. And I found that
>>>>> the oder is the same as the order by DICOM instanceNumber tag. However,
>>>>> some doctors tell me that the order should be reversed because the scan
>>>>> should start from head to foot.
>>>>>
>>>>> @David, if I need to reverse, how to achieve that by your DICOM reader?
>>>>>
>>>>> Thanks
>>>>> Liu Peng
>>>>>
>>>>
>>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170829/181b0fbe/attachment.html>


More information about the vtkusers mailing list