<div dir="ltr">Hi,<br><br>I'm trying to read a DICOM volume and extract orthogonal slices from it using vtkImageReslice. After I extract the slice I'm using a vtkImageViewer to view the slice. Here is the code:<br>
<br> std::string strFolderPath = "/home/talita/Desktop/WRIX/WRIST RIGHT/T2 TSE AX FS RT. - 3";<br> reader = vtkDICOMImageReader::New(); <br> reader->SetDirectoryName(strFolderPath.c_str());<br> reader->Update();<br>
<br> reader->SetDataScalarTypeToUnsignedShort();<br> reader->UpdateWholeExtent(); <br> reader->GetOutput()->UpdateInformation();<br><br> double sp[3];<br> reader->GetOutput()->GetSpacing(sp);<br>
int extent[6];<br> double origin[3];<br> reader->GetOutput()->GetWholeExtent(extent);<br> reader->GetOutput()->GetOrigin(origin);<br><br> double center[3];<br> center[0] = origin[0] + sp[0] * 0.5 * (extent[0] + extent[1]); <br>
center[1] = origin[1] + sp[1] * 0.5 * (extent[2] + extent[3]); <br> center[2] = origin[2] + sp[2] * 0.5 * (extent[4] + extent[5]); <br><br> // Matrices for axial, coronal, sagittal, oblique view orientations<br>
static double axialElements[16] = {<br> 1, 0, 0, 0,<br> 0, 1, 0, 0,<br> 0, 0, 1, 0,<br> 0, 0, 0, 1 };<br><br> static double coronalElements[16] = {<br> 1, 0, 0, 0,<br>
0, 0, 1, 0,<br> 0,-1, 0, 0,<br> 0, 0, 0, 1 };<br><br> static double sagittalElements[16] = {<br> 0, 0,-1, 0,<br> 1, 0, 0, 0,<br> 0,-1, 0, 0,<br> 0, 0, 0, 1 };<br>
<br> vtkMatrix4x4 *resliceAxes = vtkMatrix4x4::New();<br> resliceAxes->DeepCopy(axialElements);<br> resliceAxes->SetElement(0, 3, center[0]);<br> resliceAxes->SetElement(1, 3, center[1]);<br> resliceAxes->SetElement(2, 3, center[2]);<br>
<br> // Extract a slice in the desired orientation<br> vtkImageReslice *reslice = vtkImageReslice::New();<br> reslice->SetInputConnection(reader->GetOutputPort());<br> reslice->SetOutputDimensionality(2);<br>
reslice->SetResliceAxes(resliceAxes);<br> //reslice->SetInterpolationModeToNearestNeighbor();<br><br> // renArea->get_vtk_viewer() returns a vtkImageViewer<br><br> renArea->get_vtk_viewer()->SetInputConnection(reslice->GetOutputPort());<br>
renArea->get_vtk_viewer()->SetColorWindow(255);<br> renArea->get_vtk_viewer()->SetColorLevel(127);<br> renArea->get_vtk_viewer()->Render();<br><br>Why I can't see the slice? Everything is black! Could anyone help me?<br>
<br>Thank you,<br><br>Talita<br></div>