[vtk-developers] Getting Pixel Value from dicom

Angiak tferreira018 at live.com.pt
Sun Dec 18 19:05:16 EST 2011


Well i changed the code a LOT, and now i can get the pixel's of my image
so i write it to a file to create a new image and the result it's right
there

http://vtk.1045678.n5.nabble.com/file/n5084733/imagem.jpg 

although this new image have the format and the borders of the bones of my
dicom CT, and belive me its really there, the image itself isnt quite good,
as you can see, its seems that the pixels have an opacity and  a trasparecy
that aren't equaly to all the pixels.

anyone know what i should do? or maybe what i shouldn't?


the code follows bellow:


 vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
reader->SetFileName("Data\\I000000093665.dcm");
reader->Update();

	//convert to unsigned char image
	vtkImageCast* originalCastFilter = vtkImageCast::New();
	originalCastFilter->SetInputConnection(reader->GetOutputPort());	
	originalCastFilter->SetOutputScalarTypeToUnsignedChar();
	originalCastFilter->Update();
	

// Getting access to data!!!
    vtkUnsignedCharArray* scalars = vtkUnsignedCharArray::SafeDownCast
(originalCastFilter->GetOutput()->GetPointData()->GetArray (0));

	int flag=0;

	for(vtkIdType i = 0; i < scalars->GetNumberOfTuples(); i++)
    {
		if(flag>reader->GetWidth()){
			myfile<<endl;
			flag=0;
		}
		myfile << (int) scalars->GetValue(i) << " ";
		flag++;
		}
    }
	
	originalCastFilter->Update();

...
etc..



if someone can help me plese tell me what i should do, i start to have a
close schedule
and i really need to make this thing to work

thanks in advance
Angiak

--
View this message in context: http://vtk.1045678.n5.nabble.com/Getting-Pixel-Value-from-dicom-tp5074987p5084733.html
Sent from the VTK - Dev mailing list archive at Nabble.com.



More information about the vtk-developers mailing list