[vtkusers] different result from vtkDICOMImageReader VS vtkDICOMReader

David Gobbi david.gobbi at gmail.com
Fri Jan 20 08:24:02 EST 2017


Hi James,

When applying thresholds to CT data, use the RescaleIntercept and
RescaleSlope so that the thresholding is based on the real data values (in
Hounsfield units).

Also see the "CT and PET rescaled values" section of the following page:
http://dgobbi.github.io/vtk-dicom/doc/api/image_reader.html

Cheers,
 - David

On Fri, Jan 20, 2017 at 1:04 AM, chenjianyyzz <chenjianyyzz at 163.com> wrote:

> Hi,
> I wonder why result from below code are different:
> -----------------Code 1: using vtkDICOMImageReader
>  --------------------------
> * vtkDICOMImageReader *reader = vtkDICOMImageReader::New();*
> * reader->SetDirectoryName("***");  <----- DICOM folder*
>
>         // After get reader, all below are same
> vtkSmartPointer<vtkMarchingCubes> boneExtraractor =
> vtkSmartPointer<vtkMarchingCubes>::New();
> boneExtraractor->SetInputConnection(reader->GetOutputPort());
> boneExtraractor->GenerateValues(1, 200, 3097);
> vtkSmartPointer<vtkPolyDataNormals> boneNormals =
> vtkSmartPointer<vtkPolyDataNormals>::New();
> boneNormals->SetInputConnection(boneExtraractor->GetOutputPort());
> boneNormals->SetFeatureAngle(60.0);
> vtkSmartPointer<vtkStripper> boneStripper = vtkSmartPointer<vtkStripper>::
> New();
> boneStripper->SetInputConnection(boneNormals->GetOutputPort());
> vtkSmartPointer<vtkPolyDataMapper> boneMapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> boneMapper->SetInputConnection(boneNormals->GetOutputPort());
> boneMapper->ScalarVisibilityOff();
> vtkSmartPointer<vtkActor> bone = vtkSmartPointer<vtkActor>::New();
> bone->SetMapper(boneMapper);
> vtkRenderer *aRenderer = vtkRenderer::New();
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(aRenderer);
> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
> aRenderer->AddActor(bone);
> renWin->Render();
> iren->Initialize();
> iren->Start();
>
> Result: please see attache screenshot: vtkDICOMImageReader.png
>
> -----------------Code 2: using vtkDICOMReader--------------------------
>  *       vtkSmartPointer<vtkStringArray> filenames = ****;
>  //<----- Fill DICOM files*
> * vtkSmartPointer <vtkDICOMFileSorter> sorter = vtkSmartPointer
> <vtkDICOMFileSorter>::New();*
> * sorter->SetInputFileNames(filenames);*
> * sorter->Update();*
> * int ns= sorter->GetNumberOfSeries();*
> * int si= 0;*
> * for (int i = 0; i<ns; i++) {*
> * if (sorter->GetFileNamesForSeries(i)->GetNumberOfValues() >
> sorter->GetFileNamesForSeries(si)->GetNumberOfValues()) {*
> * si= i;*
> * }*
> * }*
> * vtkStringArray *sf= sorter->GetFileNamesForSeries(si);*
> * vtkDICOMReader *reader = vtkDICOMReader::New();*
> * reader->RemoveAllInputs();*
> * reader->SetFileNames(sf);*
> * reader->AutoRescaleOff();*
> * reader->Update();*
>
>         // After get reader, all below are same
> vtkSmartPointer<vtkMarchingCubes> boneExtraractor =
> vtkSmartPointer<vtkMarchingCubes>::New();
> boneExtraractor->SetInputConnection(reader->GetOutputPort());
> boneExtraractor->GenerateValues(1, 200, 3097);
> vtkSmartPointer<vtkPolyDataNormals> boneNormals =
> vtkSmartPointer<vtkPolyDataNormals>::New();
> boneNormals->SetInputConnection(boneExtraractor->GetOutputPort());
> boneNormals->SetFeatureAngle(60.0);
> vtkSmartPointer<vtkStripper> boneStripper = vtkSmartPointer<vtkStripper>::
> New();
> boneStripper->SetInputConnection(boneNormals->GetOutputPort());
> vtkSmartPointer<vtkPolyDataMapper> boneMapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> boneMapper->SetInputConnection(boneNormals->GetOutputPort());
> boneMapper->ScalarVisibilityOff();
> vtkSmartPointer<vtkActor> bone = vtkSmartPointer<vtkActor>::New();
> bone->SetMapper(boneMapper);
> vtkRenderer *aRenderer = vtkRenderer::New();
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(aRenderer);
> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
> aRenderer->AddActor(bone);
> renWin->Render();
> iren->Initialize();
> iren->Start();
>
> Result: please see attache screenshot: vtkDICOMReader.png
> ===============================
> the result from vtkDICOMImageReader is what I expected. and the result
> from vtkDICOMImageReader  seems only skin is visuable, and bone is
> invisable.
> any body can tell me why?  how should I update the code of vtkDICOMReader
> to visualize the bone structure?
>
> Thanks
> James
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170120/4da33f50/attachment.html>


More information about the vtkusers mailing list