[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make a .Dat file from DICOM series?



Paolo Marcheschi (paolo@ifc.pi.cnr.it) writes:

> Hi I am  new at programming in IDL.
> 
> I'd like to make a .dat file from a series of DICOM images , is there a
> simple way to do it ?
> I wanto use slicer3 to analyze them.

Finally! A new user who wants to do something simple!
OK, I'll handle this one. :-)

Create a 3D array the same size as your images. The
third dimension will be the number of "frames" you
are going to have. Say each image is 300 by 400 and
you will have 10 of them. (I assume your DICOM
images are integer arrays.)

   dataArray = IntArr(300, 400, 10)

Read each DICOM image and load it into the data array:

   FOR j=0,9 DO BEGIN
      filename = 'myfile' + StrTrim(j,2) + '.dcm'
      image = Read_Dicom(filename)
      dataArray[*,*,j] = image
   ENDFOR

Send the whole mess to Slicer3:

   ptr = Ptr_New(dataArray, /No_Copy)
   Slicer3, ptr

If you want to save it out to a file:

   OpenW, 'myfile.dat', lun, /Get_Lun
   WriteU, lun, *ptr
   Free_Lun, lun

That's it. Pretty simple. :-)

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155