[vtkusers] different result from vtkDICOMImageReader VS vtkDICOMReader

chenjianyyzz chenjianyyzz at 163.com
Fri Jan 20 03:04:58 EST 2017


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/e7702cbb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkDICOMImageReader.png
Type: image/png
Size: 30177 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170120/e7702cbb/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkDICOMReader.png
Type: image/png
Size: 55148 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170120/e7702cbb/attachment-0001.png>


More information about the vtkusers mailing list