Discussion:
[vtkusers] help to read DICOM image
John Doe
2007-09-18 16:49:03 UTC
Permalink
hello all, i need to read the information in DICOM images such as modality, patient sex, etc..

i have tried to use vtkMedicalImageReader2 and vtkMedicalImageProperties, but still failed to get what i need..

void main()
{
vtkMedicalImageReader2 *reader=vtkMedicalImageReader2::New();
reader->SetFileName("image.dcm");
printf("%s",reader->GetMedicalImageProperties()->GetPatientSex());
printf("%s",reader->GetMedicalImageProperties()->GetPatientAge());
printf("%s",reader->GetMedicalImageProperties()->GetModality());
}

WHY all of the functions getpatientage, getpatientsex, etc. all return NULL value..
can someone help me with this? btw, i have tried to use vtkDICOMImageReader too, but i can only get the patientname with that class since vtkDICOMImageReader just have GetPatientName() function..
And I guarantee that my sample DICOM images are not broken..


Thanx in advance..

Regards, John..



---------------------------------
Shape Yahoo! in your own image. Join our Network Research Panel today!
J***@lumc.nl
2007-09-19 06:20:29 UTC
Permalink
You have to call reader->Update (), otherwise nothing is actually read.

best,
Jeroen


________________________________

From: vtkusers-bounces+j.s.wijnhout=***@vtk.org
[mailto:vtkusers-bounces+j.s.wijnhout=***@vtk.org] On Behalf Of John
Doe
Sent: Tuesday, September 18, 2007 6:49 PM
To: ***@vtk.org
Subject: [vtkusers] help to read DICOM image


hello all, i need to read the information in DICOM images such
as modality, patient sex, etc..

i have tried to use vtkMedicalImageReader2 and
vtkMedicalImageProperties, but still failed to get what i need..

void main()
{
vtkMedicalImageReader2
*reader=vtkMedicalImageReader2::New();
reader->SetFileName("image.dcm");

printf("%s",reader->GetMedicalImageProperties()->GetPatientSex());

printf("%s",reader->GetMedicalImageProperties()->GetPatientAge());

printf("%s",reader->GetMedicalImageProperties()->GetModality());
}

WHY all of the functions getpatientage, getpatientsex, etc. all
return NULL value..
can someone help me with this? btw, i have tried to use
vtkDICOMImageReader too, but i can only get the patientname with that
class since vtkDICOMImageReader just have GetPatientName() function..
And I guarantee that my sample DICOM images are not broken..


Thanx in advance..

Regards, John..




________________________________

Shape Yahoo! in your own image. Join our Network Research Panel
today!
<http://us.rd.yahoo.com/evt=48517/*http://surveylink.yahoo.com/gmrs/yaho
o_panel_invite.asp?a=7>
m***@john.petra.ac.id
2007-09-19 06:40:59 UTC
Permalink
Thanx for the answer, but i still can't get what i want..
Do you mean like this??

void main()
{
vtkMedicalImageReader2*reader=vtkMedicalImageReader2::New();
reader->SetFileName("image.dcm");

//
reader->Update();
//

printf("%s",reader->GetMedicalImageProperties()->GetPatientSex());

printf("%s",reader->GetMedicalImageProperties()->GetPatientAge());

printf("%s",reader->GetMedicalImageProperties()->GetModality());
}

All of the functions still return NULL..
Or maybe this is a bug??


Regards, John.
J***@lumc.nl
2007-09-19 06:49:19 UTC
Permalink
Post by m***@john.petra.ac.id
Thanx for the answer, but i still can't get what i want..
Do you mean like this??
void main()
{
vtkMedicalImageReader2*reader=vtkMedicalImageReader2::New();
reader->SetFileName("image.dcm");
//
reader->Update();
Indeed, however I'm using the vtkDICOMImageReader. The
vtkMedicalImageReader2
is a parent class (according to the documentation) and has only one
implementation:
vtkGESignaReader (I'm talking about Vtk 5.0). It may very well be that
an instantiation of vtkMedicalImageReader2 does nothing, which suprises
me really. Perhaps there will be
more implementations of vtkMedicalImageReader2 in a next version of Vtk.

best,
Jeroen
Hellice
2012-03-19 17:50:29 UTC
Permalink
Am using vtk 5.6 and the same prob here;

--
View this message in context: http://vtk.1045678.n5.nabble.com/help-to-read-DICOM-image-tp1235165p5577797.html
Sent from the VTK - Users mailing list archive at Nabble.com.

Loading...