function data1 = get_data(folder,ind)
% Function get_data retrievers the image MRI data
% The input parameters
%   o folder - a path of the folder that contains subfolders with MRI data
%   o ind - vector of indices of the scans 
% The output parameters
%   o data1 - a cell that contains image data
for i = 1:length(ind)
    % setting the path of directories for ImageDataObject function
    dirpath = [folder '\' sprintf('%0.1d',ind(i)) '\pdata\1'];
    dseqpath=[dirpath '\2dseq'];
    visupath=[dirpath '\visu_pars'];
    % using the ImageDataObject function from Bruker software package to
    % read the data and convert the raw data into image data
    obj=ImageDataObject(dseqpath, visupath);
    DataSize = size(obj.data);
    % saving the image to the data1 cell
    if length(DataSize)==7
        for k = 1:DataSize(end)
            for j = 1:DataSize(end-1)
                data1{1,i}{j,k} = obj.data(:,:,1,1,1,j,k);
            end
        end
    else
    data1{1,i}{1,1} = obj.data(:,:,1,1,1);
    end        
end