[vtkusers] vtkDICOMImageReader and vtkImageShiftScale
Bill Lorensen
bill.lorensen at gmail.com
Wed Jun 24 11:23:37 EDT 2009
double range[1];
should be
double range[2];
On Wed, Jun 24, 2009 at 9:14 AM, Alex Duţu<alex.dutu at gmail.com> wrote:
> Thank you Francois,
>
> I have one more problem at scale->SetInputConnection or scale->SetInput. My
> code looks like this:
>
> vtkDICOMImageReader *dicomReader = vtkDICOMImageReader::New();
> dicomReader->SetDirectoryName("D:/MANIX/CER-CT/AVEC I.V");
> dicomReader->SetDataScalarTypeToUnsignedShort();
> dicomReader->UpdateWholeExtent();
> double range[1];
> dicomReader->GetOutput()->GetPointData()->GetScalars()->GetRange(range);
> //I could have used
> //dicomReader->GetOutput()->GetScalarRange(range);
>
> vtkImageShiftScale *scale = vtkImageShiftScale::New();
> scale->SetInputConnection(dicomReader->GetOutputPort());
> //scale->SetInput(dicomReader->GetOutput());
> scale->SetShift(-range[0]);
> scale->SetScale(VTK_UNSIGNED_SHORT_MAX/(range[1]-range[0]));
> scale->SetOutputScalarTypeToUnsignedShort();
> scale->Update();
>
> I got this error:
>
> Unhandled exception at 0x00594c21 in RayCast.exe: 0xC0000005: Access
> violation reading location 0x40a7fc34.
>
> at
>
> int vtkAlgorithm::GetNumberOfOutputPorts()
> {
> return this->OutputPortInformation->GetNumberOfInformationObjects();
> }
>
> and if I used scale->SetInput(dicomReader->GetOutput()); I got:
>
> Unhandled exception at 0x0058dae3 in RayCast.exe: 0xC0000005: Access
> violation reading location 0x40a7fc2c.
>
> at
>
> int vtkAlgorithm::HasExecutive()
> {
> return this->Executive ? 1 : 0;
> }
>
> Any thoughts?
>
> Thanks,
> Alex
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list