comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: GE PET DICOM format
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: GE PET DICOM format [message #37980] Wed, 11 February 2004 14:19
mmiller3 is currently offline  mmiller3
Messages: 81
Registered: January 2002
Member
>>>> > "karin" == karin knesaurek <karin.knesaurek@mssm.edu> writes:

> Can somebody help me with GE PET DICOM format. A set of
> corronal or sagittal slices are all placed in one
> directory. I can read all files but I don't know how to put
> them in order because GE names them by using bed position,
> rather than order, first, second, etc.

Here's a fragment showing how I assemble dicom files into a
volume. It doesn't do much error checking, but does order slices
according to the slice locations. If you try to read from a
directory with a mixture of studies in it, this will happily mix
them and give you scrambled results.

Mike

--
Michael A. Miller mmiller3@iupui.edu
Imaging Sciences, Department of Radiology, IU School of Medicine



function read_dicom, dirname

filelist = findfile( dirname+'/*' )

print, 'Loading the ', N_Elements(filelist), $
' DICOM files from the directory ', dirname

nFiles = N_Elements(filelist)

zdim = nFiles

slice_locations = fltarr(nFiles)
slice_thicknesses = fltarr(nFiles)

dcm = Obj_New('IDLffDICOM')

for i = 0, nFiles-1 do begin
;; Read DICOM tags from the file
dcm->Reset
;;print, 'trying ', filelist[i]
var = dcm->Read(filelist[i])

;; check if its really a DICOM format file
if (var eq 0) then $
begin
error = 'not a DICOM directory'
return, error
endif

image_type = *(dcm->GetValue('0008'x,'0008'x))[0]

slice_locations[i] = *(dcm->GetValue('0020'x,'1041'x))[0]
slice_thickness = *(dcm->GetValue('0018'x,'0050'x))[0]
xdim = *(dcm->GetValue('0028'x,'0010'x))[0]
ydim = *(dcm->GetValue('0028'x,'0011'x))[0]
pixel_size = *(dcm->GetValue('0028'x,'0030'x))[0]

endfor

sorted_indeces = sort(slice_locations)
sorted_slice_locations = slice_locations[sort(slice_locations)]

slice_intervals = fltarr(N_Elements(sorted_slice_locations)-1)
slice_intervals = sorted_slice_locations[0:N_Elements(slice_locations)-2] $
- sorted_slice_locations[1:N_Elements(slice_locations)-1]
mean_slice_interval = abs(mean(slice_intervals))

data = intarr(xdim, ydim, nFiles)
for i = 0, nFiles-1 do begin
data(*,*,i) = read_dicom(filelist[sorted_indeces[i]])
endfor

flt_image = float(data)

xsize = float(strmid(pixel_size, 0, strpos(pixel_size, '\')))
ysize = float(strmid(pixel_size, strpos(pixel_size, '\')+1))
zsize = mean_slice_interval

return, data
end
[Message index]
 
Read Message
Previous Topic: Problem with IDL 6.0, smb://, PowerMac G4, OS 10.2.8
Next Topic: That filelength question - again ....

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 12:30:19 PDT 2025

Total time taken to generate the page: 0.47903 seconds