marksgraham / DW-POSSUM

Simulate realistic diffusion-weighted MR data
MIT License
18 stars 7 forks source link

How to run with Spin echo possum #8

Closed SimonMathieu1804 closed 3 years ago

SimonMathieu1804 commented 3 years ago

Dear Mark Graham

I am trying to simulate DW data with artifacts from eddy current, motion and susceptibility distortions.

You said that "We have extended POSSUM to simulate spin-echo sequences, enabling (in combination with this codebase) the simulation of DW-MR data with susceptibility artefacts". So, I have extended my installation of FSL with the files provided in the spin echo possum github and it seems to be ok.

My problem is that I don't really see what to change with the commands of DW-POSSUM to simulate also the susceptibility now that I have SE-Possum. Do I need extra files and is there default files to test ? For example do I need to change the MRpar manually each time ?

It also seems that I have problems to simulate the motion with DW-Possum. The file 'Test/Distortions/Motion/' stays empty.

Thank you in advance Simulate DW data will be very useful for my Master's thesis :)

marksgraham commented 3 years ago

Hi,

Try this simulation dir - it has a suceptibility field in it (b0z_dz.nii.gz) and a spin-echo pulse sequence, see if you can run the simulation with possumX? https://www.dropbox.com/sh/ci28arpcjh1u8xq/AADhwhQNgyhltFEqwluy6rHya?dl=0

The change for spin-echo is the pulse file - if you run pulse to generate a pulse file there should be an se-epi option you can select.

Let me know how you can on with those?

SimonMathieu1804 commented 3 years ago

Thank you, I have tried to run PossumX on your provided file, I had no error and no information in the error logs but the image_abs and phase are both empty. To simulate motion and susceptibility and the same time don't I also need b0x_dx, b0x_dy ... b0z_dy ?

marksgraham commented 3 years ago

Could you try without any motion file now, just to check that you've got the SE-enabled possumX working? By the way, did you compile POSSUM?

SimonMathieu1804 commented 3 years ago

Yes I compiled possum I will try without motion and I will tell you what I get thanks for your help

SimonMathieu1804 commented 3 years ago

I found out that indeed it was an error of compilation. We are currently trying to fix it. In the meantime, we are also working on the simulated data you provided and I was wondering what are the motion files used for the large and small movement data ? This would allow me to compare my motion correction technique with the 'real' motion Thank you very much

SimonMathieu1804 commented 3 years ago

Also, is the motion specified in the motionN.txt files corresponding to volume-to-volume motion or motion within the volume ? I don't really understand what it corresponds to if I want to compare the motion estimated by eddy (FSL) and the true motion of the simulation.

Finally, I would like to add Gibbs ringing to the simulated data. So I was wondering if any work had already been done in this direction within this framework.

Thank you in advance for you help

marksgraham commented 3 years ago

Each motion.txt files describes the motion for one volume. If there is just two lines, like here: https://github.com/marksgraham/DW-POSSUM/blob/master/Files/Motion/inter_volume_example/motion0.txt this describes rigid movement of the head before acquistion begins, so it is simple 'volume-to-volume' movement. More complicated motion files wil have many lines epresenting movement during the acquistion. More info here: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/POSSUM/UserGuide#Motion_sequence

Gibbs ringing: you need to add a phase shift to alternate lines in k-space - possum can produce the k-space for you as an output. You would then convert the k-space to image space using the signal2image command line tool. It hasn't been done with this framework AFAIK but should not be too hard too do

SimonMathieu1804 commented 3 years ago

For gibbs ringing wouldn't it work to convolve the image with a sinc function that corresponds to the truncation window in k-space ? I do not really understand the fact that I would need to add a phase shift to alternate lines in k-space.

For motion, if I understand correctly for each volume N, it undergoes a rigid movement at time 1e-9s ? what does that 1e-9 corresponds to in DW Possum ? Is it a time step before the acquisition ? I guess the motion is given for each volume in absolute and not compared to the previous volume for the simulated diffusion data ? Would you accept to provide the motion text files used to simulate the large and small motion of the NITRC Simulated Diffusion-Weighted Dataset ?

Sorry for all the questions. Using simulated diffusion data would be really benefitial for my Master's Thesis. Thank you in advance

marksgraham commented 3 years ago

Very sorry, I was talking about ghosting, and not Gibbs ringing! Gibbs ringing already happens in POSSUM, but it can be subtle. If you get possum to output the k-space and reconstruct using signal2image then you can alter the amount of ringing by adjusting the options for apodization, limit, and roll. You could also do this more crudely by truncating the k-space manually (the k-space file can be opened in e.g. matlab, python) to remove the high frequency components and then applying signal2image.

Time 1e-9s is basically saying: apply the motion at the very beginning, before any of the pulse sequence has been applied. The time is relative to the timings in the pulsefile, which dsscribes the gradients that need to be applied and when. Again can be opened in matlab or python to view.

I'm not 100% which motion files I used to generate the NITRC data, it was quite a long time ago. But I think it may be these: Archive.zip

SimonMathieu1804 commented 3 years ago

Thank you for your help

Just is it normal that the Archive you just provided me only contains 35 motion files for 108 volumes ?

marksgraham commented 3 years ago

Sorry, that can't be right. I can't find the correct motion files I used to simulate that dataset, I'm afraid. I recommend you produce your own motion files (i can help you out with that) and use these to simulate the data - that way you can be sure they match up!

SimonMathieu1804 commented 3 years ago

Dear Mark Graham,

I have finally managed to simulate data with the susceptibility artifacts from the files you provided by running possumX. However it still only provides me a single volume and not diffusion data. How can I combine the SE-Possum with this DW-possum library in order to transform it in diffusion data. Do I only run the third post_process command on the obtained output file of possumX ? Also, If I add motion in addition to susceptibility should I also have b0x_dx, b0x_dy ... b0z_dy files when running possumX even if I add the motion during the postprocess stage of DW possum ?

I have also successfully managed to simulate additional GIbbs ringing, thank you.

marksgraham commented 3 years ago

Hi,

You still need to run all the steps from the DW-POSSUM repository if you want to get a set of volumes with diffusion weighting. The difference now is that: in step one, you point towards a simdir, in the example it is Files/POSSUMdirectories/possumSimdirOneSlice/. You should copy this folder, add all the susceptibility files you need, and use the pulse command, pointing to the input files in that foler, in order to make a spin-echo sequence with all the parameters (e.g. number of slices, resolution) that you need

It may be helpful to run through the example in DW-POSSUM to familarise yourself with it before you start to incorporate the SE parts.

You do need b0x etc if you have motion and susceptibility during the simulation. You need to create these files using b0calc on an air-tissue segmentation. You can generate the air-tissue segmentation from the input object you use in your simulations. See: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/POSSUM/UserGuide#Motion_case

SimonMathieu1804 commented 3 years ago

Thank you for your help very much !

I have just one final question, I am not sure to understand how I can obtain the air-tissue segmentation from the input object. Indeed, I need the field_map but I don't have any field_map in the input ?

marksgraham commented 3 years ago

You need to create a binary volume with 1 where there is any tissue in your input object, and 0 otherwise. You can do this using fslmaths commands or in Python/Matlab etc. Using b0calc on that should generate all the fieldmap files you need: the main map and all the extra components