we create a new extension to load dicom image, code as below:
// add to volume node
double dirs[3][3];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
dirs[i][j] = 0.0;
dirs[0][0] = 1;
dirs[1][1] = 1;
dirs[2][2] = 1;
auto volumeNode = vtkMRMLScalarVolumeNode::SafeDownCast(
this->logic()->GetMRMLScene()->AddNewNodeByClass("vtkMRMLScalarVolumeNode", "Source"));
volumeNode->SetAndObserveImageData(vtkImageDataPointer);
//volumeNode->SetOrigin(100,100,100);
//volumeNode->SetSpacing(1,1,1);
//volumeNode->SetIJKToRASDirections(dirs );
volumeNode->CreateDefaultDisplayNodes();
volumeNode->SetDisplayVisibility(true);
the problem is that
- the image isn’t displayed without click “visible” button
- it show nothing if drag slider to change slicer in “blue” rect range
- image displayed on the right-down of view