diff --git a/CT/infoCT.m b/CT/infoCT.m index 160d15d..c2b3fdc 100644 --- a/CT/infoCT.m +++ b/CT/infoCT.m @@ -1,309 +1,309 @@ %% infoCT % This script lists the technical and the personal informations linked to the dicoms for % "Pathologic" and "Normal" patients and returns the excel file "InfoCT". % % INPUT: 'normal' or 'pathologic' % Author: RO-EPFL-LBO % Date: 2016-09-05 %% function infoCT XLSShoulderDatabaseLocation = '../../../data/Excel/'; % Location of the XLS ShoulderDatabase list{1,1} = 'sCase.id'; list{1,2} = 'patient.IPP'; list{1,3} = 'patient.initials'; list{1,4} = 'patient.gender'; list{1,5} = 'patient.birth_date'; %list{1,6} = 'patient.age'; %list{1,7} = 'patient.ethnicity'; list{1,6} = 'patient.height'; list{1,7} = 'patient.weight'; %list{1,10} = 'patient.BMI'; list{1,8} = 'shoulder.side'; list{1,9} = 'CT.date'; list{1,10} = 'CT.kernel'; list{1,11} = 'CT.pixel_size'; list{1,12} = 'CT.slice_spacing'; list{1,13} = 'CT.slice_thickness'; list{1,14} = 'CT.tension'; list{1,15} = 'CT.current'; list{1,16} = 'CT.institution'; list{1,17} = 'CT.manufacturer'; list{1,18} = 'CT.model'; list{1,19} = 'CT.protocol'; directory = '../../../data'; %% Loop over all the normal and pathologic cases location = 'N'; l=1; rootDir = '../../../data/N'; for levelDir1 = 0:9 for levelDir2 = 0:9 curentDir = sprintf('%s/%d/%d/N*', rootDir, levelDir1, levelDir2); folderInfo = dir(curentDir); for i=1:1:numel(folderInfo) name = folderInfo(i).name; sCases_normal{l,1} = folderInfo(i).name; sCases_normal{l,2} = levelDir1; sCases_normal{l,3} = levelDir2; sCases_normal{l,4} = 'N'; l=l+1; end end end location = 'P'; l=1; rootDir = '../../../data/P'; for levelDir1 = 0:9 for levelDir2 = 0:9 curentDir = sprintf('%s/%d/%d/P*', rootDir, levelDir1, levelDir2); folderInfo = dir(curentDir); for i=1:1:numel(folderInfo) name = folderInfo(i).name; sCases_pathologic{l,1} = folderInfo(i).name; sCases_pathologic{l,2} = levelDir1; sCases_pathologic{l,3} = levelDir2; sCases_pathologic{l,4} = 'P'; l=l+1; end end end sCases = [sCases_normal;sCases_pathologic]; %% Data exportation from dicom for j=2:1:numel(sCases(:,1))+1 patient = char(sCases(j-1,1)) levelDir1 = cell2mat(sCases(j-1,2)); levelDir2 = cell2mat(sCases(j-1,3)); location = char(sCases(j-1,4)); finalDirectory = sprintf('%s/%s/%d/%d', directory, location, levelDir1, levelDir2); if exist(sprintf('%s/%s/CT-%s-1/dicom', finalDirectory,patient,patient),'dir') == 7 %if a folder "dicom" exist, the patient name is added to the "measured" column % directoryin=list(j,1); % directoryin=char(directoryin); ctdirectoryin = sprintf('%s/%s/CT-%s-1/dicom',finalDirectory, patient, patient); images = dir(ctdirectoryin); ct=images(10).name; ct2=images(11).name; inpath=[ctdirectoryin,'/',ct]; inpath2=[ctdirectoryin,'/',ct2]; info=dicominfo2(inpath); info2=dicominfo2(inpath2); %Patient# list{j,1} = strtok(patient,'-'); %Weight tf = isfield(info,'PatientWeight'); % Test si le champ "PatientWeight" existe if tf==1 weight=info.PatientWeight; else weight=' '; end list{j,7} = weight; %Height tf = isfield(info,'PatientSize'); % Test si le champ "PatientSize" existe if tf==1 Size=info.PatientSize; Size=Size*100; Size=round(Size,0); else Size=' '; end list{j,6} = Size; %Gender tf = isfield(info,'PatientSex'); % Test si le champ "PatientSex" existe if tf==1 gender=info.PatientSex; else gender=' '; end list{j,4} = gender; %Birth date tf = isfield(info,'PatientBirthDate'); % Test si le champ "PatientBirthDate" existe if tf==1 date=info.PatientBirthDate; else date=' '; end list{j,5} = date; %CT date tf = isfield(info,'AcquisitionDate'); % Test si le champ "AcquisitionDate" existe if tf==1 ctdate=info.AcquisitionDate; else ctdate=' '; end list{j,9} = ctdate; %IPP tf = isfield(info,'PatientID'); % Test si le champ "PatientID" existe if tf==1 id=info.PatientID; else id=' '; end list{j,2} = id; %Kernel tf = isfield(info,'ConvolutionKernel'); % Test si le champ "ConvolutionKernel" existe if tf==1 kernel=info.ConvolutionKernel; else kernel=' '; end list{j,10} = kernel; %Pixel Size tf = isfield(info,'PixelSpacing'); % Test si le champ "PixelSpacing" existe if tf==1 pixel1=info.PixelSpacing(1); %pixel2=info.PixelSpacing(2); pixel1=num2str(pixel1); %pixel2=num2str(pixel2); %pixel= ['[',pixel1,',',pixel2,']']; pixel= [,pixel1,]; else pixel=' '; end list{j,11} = pixel; %Slice Thickness tf = isfield(info,'SliceThickness'); % Test si le champ "SliceThickness" existe if tf==1 thickness=info.SliceThickness; else thickness=' '; end list{j,13} = thickness; %Tension tf = isfield(info,'KVP'); % Test si le champ "KVP" existe if tf==1 tension=info.KVP; else tension=' '; end list{j,14} = tension; %Current tf = isfield(info,'XrayTubeCurrent'); % Test si le champ "XrayTubeCurrent" existe if tf==1 current=info.XrayTubeCurrent; else current=' '; end list{j,15} = current; %Institution Name tf = isfield(info,'InstitutionName'); % Test si le champ "InstitutionName" existe if tf==1 instname=info.InstitutionName; else instname=' '; end list{j,16} = instname; %Manufacturer tf = isfield(info,'Manufacturer'); % Test si le champ "Manufacturer" existe if tf==1 manufacturer=info.Manufacturer; else manufacturer=' '; end list{j,17} = manufacturer; %Model Name tf = isfield(info,'ManufacturerModelName'); % Test si le champ "ManufacturerModelName" existe if tf==1 manufacturermn=info.ManufacturerModelName; else manufacturermn=' '; end list{j,18} = manufacturermn; %Protocol Name tf = isfield(info,'ProtocolName'); % Test si le champ "ProtocolName" existe if tf==1 protocol=info.ProtocolName; else protocol=' '; end list{j,19} = protocol; %Spacing Between Slices tf = isfield(info,'ImagePositionPatient'); % Test si le champ "ImagePositionPatient" existe if tf==1 pos1 = info.ImagePositionPatient(3); pos2 = info2.ImagePositionPatient(3); %pixel1=num2str(pixel1); %pixel2=num2str(pixel2); %pixel= ['[',pixel1,',',pixel2,']']; space2= abs(pos1-pos2); else space2=' '; end list{j,12} = space2; % %Patient Name % tf = isfield(info,'PatientName'); % Test si le champ "PatientName" existe % % if tf==1 % name = info.PatientName.FamilyName; % % %pixel1=num2str(pixel1); % % else % name=' '; % end % list{j,8} = name; else list{j,1} = strtok(patient,'-'); end end delete([XLSShoulderDatabaseLocation 'xlsFromMatlab/CT.xls']); -xlswrite('xlsFromMatlab/CT', list) +xlswrite([XLSShoulderDatabaseLocation 'xlsFromMatlab/CT'], list) addpath('XLS_MySQL_DB'); MainExcel2SQL; end