
function  scanData = readInScanData()
    cd('D:\SimulationData\SimulatedDataExperimentR\Matrix170\TRUEX120M170G0_dicom');
    allDicoms = dir();
    name = allDicoms(3).name;
    info = dicominfo(name);
    for i = 1:length(allDicoms)
        name = allDicoms(i).name; 
        if length(name) >2
           info = dicominfo(name);
           image = dicomread(name);
           image = image * info.RescaleSlope + info.RescaleIntercept;
           threeDimage = image(:,:,:,1);
           size0 = size(threeDimage);
           imageSize = size(image);
           threeDimage(end,end,imageSize(4)) = 0;
           for j=1:imageSize(4)
               actualImage =image(:,:,:,j);
               actualImage = setSpineToZeroSim(actualImage);


               if ~isequal(size(actualImage), size0)
                    warning( sprintf('skipped file %s, wrong data size', thisfile ) );
               else
                threeDimage(:,:,j) = actualImage;
                
               end
           end

           [sphereValues threeDimage recoveryCoeff] = getSpheresSimulation(info, threeDimage);
            background = getBackground( threeDimage );
            writeDataToCSVSim( name, background, sphereValues, recoveryCoeff );
                    
       end
    end
end


