Thank you Francois,<br><br>I have one more problem at scale->SetInputConnection or scale->SetInput. My code looks like this:<br><br> vtkDICOMImageReader *dicomReader = vtkDICOMImageReader::New();<br> dicomReader->SetDirectoryName("D:/MANIX/CER-CT/AVEC I.V");<br>
dicomReader->SetDataScalarTypeToUnsignedShort();<br> dicomReader->UpdateWholeExtent();<br> double range[1];<br> dicomReader->GetOutput()->GetPointData()->GetScalars()->GetRange(range);<br> //I could have used <br>
//dicomReader->GetOutput()->GetScalarRange(range);<br><br> vtkImageShiftScale *scale = vtkImageShiftScale::New();<br> scale->SetInputConnection(dicomReader->GetOutputPort());<br> //scale->SetInput(dicomReader->GetOutput());<br>
scale->SetShift(-range[0]);<br> scale->SetScale(VTK_UNSIGNED_SHORT_MAX/(range[1]-range[0]));<br> scale->SetOutputScalarTypeToUnsignedShort();<br> scale->Update();<br><br>I got this error:<br><br>Unhandled exception at 0x00594c21 in RayCast.exe: 0xC0000005: Access violation reading location 0x40a7fc34.<br>
<br>at <br><br>int vtkAlgorithm::GetNumberOfOutputPorts()<br>{<br> return this->OutputPortInformation->GetNumberOfInformationObjects();<br>}<br><br>and if I used scale->SetInput(dicomReader->GetOutput()); I got:<br>
<br>Unhandled exception at 0x0058dae3 in RayCast.exe: 0xC0000005: Access violation reading location 0x40a7fc2c.<br><br>at <br><br>int vtkAlgorithm::HasExecutive()<br>{<br> return this->Executive ? 1 : 0;<br>}<br><br>Any thoughts?<br>
<br>Thanks,<br>Alex<br>