xcist / main

simulation and reconstruction package
BSD 3-Clause "New" or "Revised" License
47 stars 24 forks source link

DICOM OUTPUT FORMAT #110

Open omrghad opened 2 weeks ago

omrghad commented 2 weeks ago

Dear All, please is there any update about geting output in Dicom format? regards

zhangjy-ge commented 2 weeks ago

Hi,

We currently don't have plans to save output in dicom format, but I believe you may do it by yourself. For example, you can read xcist output using rawread, then save data as dicom using third-party libraries such as pydicom.

omrghad commented 2 weeks ago

thank you for your reply, i tried many times to convert .raw to dicom format, but it does not work @ if anyone did this successfully, please help regards

brandonjnelsonFDA commented 2 weeks ago

We have a slightly fuller example here @omrghad that you can adapt for your purposes to write out numpy arrays into dicom using pydicom: https://github.com/DIDSR/pediatricIQphantoms/blob/main/src/pediatricIQphantoms/make_phantoms.py#L144-L230

As suggested by @zhangjy-ge you'll need to load in the .raw files as a numpy array first. In the example cited above we organize this into an object to store various variables need to update the dicom header, in particular the self.recon attribute holds the 3D volume and gets written out slice by slice

Alternatively pydicom provides more basic examples for writing out files