Hi, I am trying to use LCmodel to analyze some older Siemens MRS data for which I only have DICOM file, no Siemens *.raw. I want to convert the data to the LCmodel *.RAW file.
Most data are series of spectra, so I would like to put them in *.RAW files with multiple spectra as columns (NDCOLS >1).
So far no luck with either single spectra or series. The *.RAW input format appears to be very finicky. I get ZEROVOX 5 errors again and again.
I tried with/without an extra newline after the last data point, with or without quotes around the FMTDAT and/or ID statements (Jamieβs code would produce without quotes, but LCmodelβs test.RAW file has quotes. I also tried FMTDAT = β(2E1.6)β, FMTDAT = β(2E15.6)β or FMTDAT = β(2E16.6)β. Nothing works.
Below is the core of the write to RAW Matlab script I wrote based on Jamie Nearβs io_writelcmraw.m.
Also, the control files produced in my efforts have the right number of columns, but the LCMgui shows 1 column every time in spite of the NDCOLs = 5 in the RAW parameters.
Can anybody help me get this right?
Thanks
Ronald
N = spectra(1).hdr.fid_size;
data = zeros( M * spectra(1).hdr.fid_size, 2);
idx = 1:N;
for ii = 1:M
idx = (1:N)+(ii-1)*N;
thesedata = spectra(ii).data(:);
if reverse
thesedata = conj(thesedata);
end
data(idx, 1:2) = [real(thesedata), imag(thesedata) ];
end % for ii
% write to .RAW txt file for LCmodel
fid=fopen(filename,βw+β);
fprintf(fid,β $SEQPAR\nβ); % begin sequence paramters
fprintf(fid,β ECHOT = %-3.1f\nβ, 1000*spectra(1).hdr.TE);
fprintf(fid,β HZPPPM=%-12.4f\nβ, spectra(1).hdr.frequency);
fprintf(fid,β DELTAT=%-15.8f\nβ, 1/spectra(1).hdr.sweepwidth );
fprintf(fid,β NUNFIL=%-6d\nβ, N );
fprintf(fid,β NDCOLS=%-3d\nβ, M );
fprintf(fid,β NDROWS=%-3d\nβ, 1 );
fprintf(fid,β SEQ = ββ%sββ\nβ, sequence );
fprintf(fid,β $END\nβ); % end sequence paramters
fprintf(fid,β $NMID\nβ); % begin format/scale paramters
fprintf(fid,β ID=ββ%sββ\nβ, filename(1:20) );
fprintf(fid,β FMTDAT=ββ(2E16.6)ββ\nβ);
fprintf(fid,β VOLUME=1.00000\nβ);
fprintf(fid,β TRAMP=1.00000\nβ);
fprintf(fid,β $END\nβ); % end format/scale paramters
fprintf(fid,β % 15.6E % 15.6E\nβ, dataβ); %space after β%β sign forces hanging negative sign
fclose(fid);