SyneRBI / SIRF

Main repository for the CCP SynerBI software
http://www.ccpsynerbi.ac.uk
Other
59 stars 29 forks source link

Can SIRF load a 3D sliced dicom CT image? #692

Closed AnderBiguri closed 4 years ago

AnderBiguri commented 4 years ago

i.e. a folder with N slices, each of them stored in a separated (e.g.) .img file.

I tried with ImageData() containers but I always get cryptic engine errors. I have a working version with pydicom, but I rather use SIRF now that I got into it.

PD: if you prefer me to ask the questions somewhere else (mailing list/slack) let me know.

rijobro commented 4 years ago

Which ImageData are you using? sirf.STIR.ImageData or sirf.Reg.ImageData? Should be former of the two. What's the error?

rijobro commented 4 years ago

Also if you have the SuperBuild set up to compile STIR executables and enable the nlohmann JSON support, you should have an executable called ctac_to_mu_values. I have no idea, but I wonder if that will take your .imgs and return you a .hv.

AnderBiguri commented 4 years ago

@rijobro STIR.ImageData, but tried Reg also, just in case.

about ctac_to_mu_values, that sounds good, but I do not want mu values, I want the CT image.

The error was:

Line: 222
check_status found the following message sent from the engine:
Traceback (most recent call last):
  File "/home/anderbiguri/Documents/MATLAB/GE/DWB-PET-WIP/Python/mask_body.py", line 29, in <module>
    stir_ct=stir.ImageData(patient_path+ct_path+"IM*")
  File "/home/anderbiguri/SIRF/build/INSTALL/python/sirf/STIR.py", line 222, in __init__
    check_status(self.handle)
  File "/home/anderbiguri/SIRF/build/INSTALL/python/sirf/Utilities.py", line 374, in check_status
    raise error(errorMsg)
sirf.Utilities.error: ??? "'Error opening file /home/anderbiguri/Documents/MATLAB/GE/DATA/UCL WBD data/P010/CTAC 3.75 Study/CTAC 3.75 Study/IM*\\n' exception caught at line 253 of /home/anderbiguri/SIRF/build/sources/SIRF/src/xSTIR/cSTIR/cstir.cpp; the reconstruction engine output may provide more information"

However, as usual, writting the question up makes you come up with a solution. I was asking for ImageData(path+"IM*") so I could load up all the IM{NUMBER} images, but changing it to "IM1" loads all of them, not just the first. Not super intuitive but works.

Still think that the errors should give better explanation of what happens, but that is a different issue :D

Post realization Edit: mu values is what I want, terminology mishap again. I though you guys called mu values the CTAC image given to the PET recon, but I realize its just attenuation coeff values.

KrisThielemans commented 4 years ago

ctac_to_mu_values isn't relevant. It'll read in an image as normal STIR, and multiply with bilinear slope to convert HU to mu-values.

KrisThielemans commented 4 years ago

Reason for letting STIR (and hence SIRF) use a single file is that you can have multiple series in a single dir. This way you can select. It would be possible to modify the STIR code (or maybe it has been done already?) to just give it a directory name, and pick the first file in there. If that's intuitive, please raise it as a STIR issue (but try it first to see if it doesn't work already!).

In any case, I think this issue can be closed?

AnderBiguri commented 4 years ago

@KrisThielemans I still do not have tested STIR on its own, so not sure I can do that check quickly.

This issue can be indeed closed.

KrisThielemans commented 4 years ago

you can do the test from SIRF

stir_ct=stir.ImageData(patient_path+ct_path)
AnderBiguri commented 4 years ago

@KrisThielemans Ah, apologies I though I already mentioned. That does not work from SIRF.

KrisThielemans commented 4 years ago

Ok. If you think useful (and not dangerous), feel free to raise a stir issue

AnderBiguri commented 4 years ago

@KrisThielemans to be honest, I have no idea how dangerous or not can this be, as I don't have a feel of how common is to have multiple dicom series in a folder and how hard it would be to check that on read. I'll leave it like it is now, until I have a better idea (or you/someone else decides to open the issue).