Why do I get different solutions using uigetfile and path strings?

1 view (last 30 days)
How does uigetfile operate? Does the second prompt overwrite the first one?
I have the following code and I want to use the commented part instead of the path strings. However while using uigetfile I don't get the wanted solution.
The rzFactor should be 1.4 and that is what i get using the path strings. Using uigetfile I just get 1.0 as the solution. How does uigetfile operate? Does the second prompt overwrite the first one?
% Open and read CT and CBCT DICOM file
% Shows all files with a .dcm extension
% inputCT_File = msgbox('Please select planning CT file in DICOM format.')
% FileName_CT = uigetfile('.dcm')
%
%
% inputCBCT_File = msgbox('Please select Cone Beam-CT file in DICOM format.')
% FileName_CBCT = uigetfile('.dcm')
FileName_CT = 'C:\Users\Deniz\Desktop\Uni\Semester 7\Bachhelor_Arbeit\Codes_24012022\Kopf\CT\CT.#_STR_IMG.Bild 10.dcm';
FileName_CBCT = 'C:\Users\Deniz\Desktop\Uni\Semester 7\Bachhelor_Arbeit\Codes_24012022\Kopf\CBCT\CT.#_STR_IMG.Bild 10.dcm';
% Get information of .dcm file
info_CT = dicominfo(FileName_CT);
info_CBCT = dicominfo(FileName_CBCT);
vz_CT = info_CT.PixelSpacing;
vz_CBCT = info_CBCT.PixelSpacing;
rzFactor = vz_CT(1)/vz_CBCT(1)

Accepted Answer

Walter Roberson
Walter Roberson on 2 Mar 2022
you should be using the two-output form of uigetfile, then fullfile() to create a complete path.

More Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!