1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- %% Author: Aleks Prša
- % Date: June, 2022
- % alex.prsa@gmail.com
- % =========================================================================
- %{
- %
- % DESCRIPTION:
- %
- % Program for inserting microcalcifications on breast projection images.
- %
- % Faculty of Mathematic and Physics
- % University in Ljubljana
- % Ljubljana, Slovenia
- %
- %}
- % =========================================================================
- %% Insertion code
- close all;clear;clc
- %% Load components
- addpath(genpath('Functions'));
- addpath(genpath('Parameters'));
- if(~exist('Output','dir'))
- mkdir('Output')
- end
- addpath('Output');
- ParameterSettings_MicroInsertion
-
- % Load projection data
- path_User = userpath;
- path_ProjData = uigetdir(path_User);
- if(path_ProjData == 0)
- fprintf('Cancelled by user \n');
- return;
- else
- userpath(path_ProjData)
- fprintf('Reading DICOMs ')
- answer = '0';
- [dataProj,infoDicom] = readDicom(path_ProjData,parameter,answer);
- parameter.bitDepth = infoDicom(:,1).BitDepth;
- end
- % Create phantom with inserted microcalcifications
- fprintf('\nPhantom...')
- microData = phantom(parameter);
- microData(microData<0) = eps;
- microData = flip(microData, 1); % Phantom in accordance with coordinate system
- microData = flip(microData, 2); % Source is on the left side
- % Perform virtual imaging of microcalcifications
- fprintf('\nProjections ')
- attenuationMicro = projectionMicro(microData,parameter);
- attenuationMicro = flip(attenuationMicro, 2); % Image captured with source on the right side
- %% Microcalcification insertion
- % Breast attenuation
- attenuationBreast = dataProj - parameter.mu;
- attenuationBreast(attenuationBreast < 0) = 0;
- % Additional attenuation due to microcalcifications
- microProj = attenuationBreast .* attenuationMicro + parameter.mu;
- %% Save data
- filestring = ['Output',filesep,'Microcalcifications',filesep,'Projections'];
- if(~exist(filestring))
- mkdir(filestring)
- end
- fprintf('\nWriting DICOM projections ')
- writeDicomProj(attenuationMicro,infoDicom,filestring,parameter);
- fprintf('\nSaving projections... \n')
- save(['Output',filesep,'Microcalcifications',filesep,'Microcalcifications.mat'],'microProj','-v7.3');
- infoDicom = [];
- fprintf('\nFINISHED - Data stored in "Microcalcification" folder\n')
- beep
|