Sigpy compatibility with BART's *.cfl files
mscipio opened this issue ยท 10 comments
I have a script that allows me to decode vendor-specific raw data from the Siemens Biograph mMR into .cfl
files (kspace and non-cartesian trajectory) that can be fed into BART
for the reconstruction.
I was wondering if sigpy
has an interface that can allow me to use the cfl
python library (e.g. function cfl.readcfl()
and cfl.writecfl()
) as input and use the way more pythonic tools provided by sigpy
for the reconstruction.
You can find the cfl input and output files in the BART repo here: https://github.com/mrirecon/bart/tree/master/python
Agree with @sidward that the BART repo already provides the functions, so it'll be best to use those instead of copying them to sigpy.
Sorry to reopen this after such a long time, but I am still having issues here and there with decoding the proprietary files I can export from my Siemens scanner. Lately I have been trying to use the siemens_to_ismrmrd
package to convert them to the ismrmrd
format (from the native twix
binary format in which I get them).
I was wondering if you had any experience using ismrmrd
files as input to sigpy
.
It should be possible to convert them to numpy
array I believe, but I am not sure if some further manipulation is required? Has anyone ever tried this?
Why does sigpy
not offer any kind of support for input files other than numpy
?
I'm sorry, I have no experience with ismrmrd
. Maybe you can try BART's twixread
function?
As for why there are no plans to support input files other than numpy:
- It's just a lot of overhead to ensure compatibility and I do not currently have the time to take that on.
- There are existing repositories that supposedly address what you want: https://github.com/ismrmrd/ismrmrd-python
If you do create a ismrmrd_to_python
repository that works better than the above, please let me know and I will link it in the README ๐
Hi @mscipio I noticed you posted the issue in the BART repo as well. Have you tried mapVBVD at all?
- https://pypi.org/project/pyMapVBVD/
- https://github.com/CIC-methods/FID-A/tree/master/inputOutput/mapVBVD
In MATLAB, the "unsorted" option returns the raw acquired data, which you can re-order as needed.
Hi @sidward
Yes, I have had relatively good success using mapvbvd
.
I wanted to use another way to decode those data because sigpy is producing some "ghosting" artifacts in the reconstruction and I am having a hard time understanding what's happening.
If you look at the rightmost subplot, it looks like the ghost image is flipped wrt the center of the image.
Right now I am getting the trajectory (which is a golden angle stack-of-spirals) from the log file of the scanner (Siemens mMR) and it looks like this:
I have a hard time believing I am doing something wrong with the trajectory (at the end of the day it's just a txt log file) so that's why I was trying to use something other than mapvbvd to decode the twix file, to see if that's was the problem
Are you acquiring multiple slices? If so, data are often acquired in a slice-interleaved manner, so you would need to manually re-order it.
Yes, as you can see from the images above, it is a 3D volume.
you would need to manually re-order it.
Correct, that's what I have been trying to do. pymapvbvd
and twixtools
(both based on Matlab's mapvbvd
) supposedly have the capability to correctly sort the acquisitions in the right multidimensional shape, but I guess that's not probably the case, given the results I am getting ...
If that's the case, that's something you would need to bring up with the maintainers of the above projects.
On my end, I have always used the unsorted data and manually re-ordered it. For Siemens, MATLAB's mapVBVD
returns the sample locations which I use to sort the data.
obj = mapVBVD(dat_file);
lin = obj{numel(obj)}.image.Lin - obj{numel(obj)}.image.centerLin;
par = obj{numel(obj)}.image.Par - obj{numel(obj)}.image.centerPar;
tbl = obj{numel(obj)}.image.unsorted();
If your acquisition is volumetric, tbl
will have dimensions along the lines of (sx, nc, nadc)
, where sx
is the readout size, nc
is the number of coils and nadc
is the number of readouts. You can loop through nadc
to build your k-space array. Keep in mind the for volumetric acquisitions, looping through nadc
is looping through ky
and kz
, and for multi-slice acquisitions, looping through nadc
is looping through ky
and z
. Additionally, you will need to re-order the z
dimension appropriately to account for the interleaved acquisition.
Hope this helps.