Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
NMR_OPTIMA_BIDS/OPTIMA_read_GE_BIDS_4.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
90 lines (69 sloc)
3.18 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BIDS = OPTIMA_read_GE_BIDS_4(BIDS) | |
% | |
% reads GE raw data structure | |
% | |
% | |
% file history: | |
% created M. Czisch & F. Binder 8.11.2017 | |
% last 15.11.2019 M.Czisch | |
files = dir; | |
BIDS.input.data_dir = ''; | |
fprintf('read GE data structure\n'); | |
% find the individual EXAM numbers | |
for i = 1:size(files,1) | |
if logical(strcmp(files(i).name(1),'e')) | |
%BIDS.input.data_dir(end+1).name = files(i).name; | |
BIDS.input.data_dir(1).name = files(i).name; | |
end | |
end | |
% find the individual SERIES numbers | |
for i=1:size(BIDS.input.data_dir,2) | |
cd(BIDS.input.dir); | |
cd(BIDS.input.data_dir(i).name) | |
files = dir; | |
for j=1:size(files,1) | |
BIDS.input.data_dir(i).subdir{j} = files(j).name; | |
end | |
end | |
% loop over the days and read dicom file information | |
for i=1:2 | |
if i==2 && size(BIDS.input.data_dir,2) == 1 | |
break; | |
else | |
fprintf('reading day %d\n', i); | |
max = size(BIDS.input.data_dir(i).subdir,2); | |
n_day(i) = 0; | |
for j=3:max | |
if ~logical(strcmp(BIDS.input.data_dir(i).subdir(j),'.')) | |
filename = [BIDS.input.dir,'/',BIDS.input.data_dir(i).name,'/',BIDS.input.data_dir(i).subdir{j},'/*.1']; | |
image = dir(filename); | |
BIDS.input.data_dir(i).image{j} = image.name; | |
filename = [BIDS.input.dir,'/',BIDS.input.data_dir(i).name,'/',BIDS.input.data_dir(i).subdir{j},'/',BIDS.input.data_dir(i).image{j}]; | |
myfile = dicominfo(filename); | |
BIDS.input.data_dir(i).Filename{j} = myfile.Filename; | |
BIDS.input.data_dir(i).PatientID{j} = myfile.PatientID; | |
BIDS.input.data_dir(i).StudyDate{j} = myfile.StudyDate; | |
BIDS.input.data_dir(i).StudyTime{j} = myfile.StudyTime; | |
BIDS.input.data_dir(i).ContentTime{j} = myfile.ContentTime; | |
BIDS.input.data_dir(i).ProtocolName{j} = myfile.ProtocolName; | |
BIDS.input.data_dir(i).SeriesDescription{j} = myfile.SeriesDescription; | |
BIDS.input.data_dir(i).FamilyName{j} = myfile.PatientName.FamilyName; | |
BIDS.input.data_dir(i).GivenName{j} = myfile.PatientName.GivenName; | |
BIDS.input.data_dir(i).N_of_slices{j} = myfile.Private_0021_104f; % number of slices, 15.11.2019 | |
%BIDS.input.data_dir(i).ImagesInAcquisition{j} = myfile.ImagesInAcquisition; | |
if strfind(myfile.ImageType,'DERIVED\') %if GE produces mean images of previous fMRI time series | |
data_dir(i).ImagesInAcquisition{j} = 0; | |
else | |
data_dir(i).ImagesInAcquisition{j} = myfile.ImagesInAcquisition; | |
end | |
if isfield(myfile, 'NumberOfTemporalPositions') | |
BIDS.input.data_dir(i).NumberOfTemporalPositions{j} = myfile.NumberOfTemporalPositions; | |
else | |
BIDS.input.data_dir(i).NumberOfTemporalPositions{j} = 1; | |
end | |
BIDS.input.data_dir(i).SequenceName{j} = myfile.Private_0019_109c; | |
end | |
end | |
end | |
% sanity check required!!!! | |
end |