From: Saurabh on
I am making a code in which i have to divide two images using imdivide command. I am expecting to get assigned values to the image pixels between 0- 1 but the final outcome is values 0 and 1 (only integers). Is it possible to get better precision ( that is decimal points) rather than just integers . The Input is double array (every image).



clear all;close all
clc;
HUmin = 0; % to select your image color
HUmax = 1;
% angle of rotation
angle = 0;
% Define where the files are stored:Dry core 120 KV
pathname1 = uigetdir('D:\gp\My Documents\MATLAB\Saturation_Visualisation_19Apr23Apr2010\0997CO2_20Apr2010_120KV\19Apr_partIa_120KV_DRY_CORE\Series_4');
% Fill matrix 'd' with the file information
d = dir(fullfile(pathname1,'*.dcm'));
% Store the filenames separately in matrix 'dicomfiles'
dicomfiles1 = {d.name};
% Count the number of dicom files, and define that count as the amount of
% frames to be visualized
S = numel(dicomfiles1);
nframes = S;
% Define where the files are stored:Saturated core 120 KV
pathname2 = uigetdir('D:\gp\My Documents\MATLAB\Saturation_Visualisation_19Apr23Apr2010\0997CO2_20Apr2010_120KV\19Apr_partIIa_saturated_core_120KV\Series_6');
% Fill matrix 'd' with the file information
e = dir(fullfile(pathname2,'*.dcm'));
% Store the filenames separately in matrix 'dicomfiles'
dicomfiles2 = {e.name};
% Count the number of dicom files, and define that count as the amount of
% frames to be visualized
% Define where the files are stored:0798 CO2 core 120 KV
pathname3 = uigetdir('D:\gp\My Documents\MATLAB\Saturation_Visualisation_19Apr23Apr2010\0997CO2_20Apr2010_120KV\20Apr_partIVa_2004CO2_0997_120KV\Series_10');
% Fill matrix 'd' with the file information
f = dir(fullfile(pathname3,'*.dcm'));
% Store the filenames separately in matrix 'dicomfiles'
dicomfiles3 = {f.name};
% Count the number of dicom files, and define that count as the amount of
% frames to be visualized
%%nn = 2;
% In this loop we visualize each dicom file separately, and then store it
% as a frame in the movie
for i=1:nframes;% image number
name1 = char(dicomfiles1(i));
% Read the dicom file:
XX = dicomread([pathname1 '\' name1]);
XX = imrotate(XX,angle,'bicubic','crop');
name2 = char(dicomfiles2(i));
% Read the dicom file:
YY= dicomread([pathname2 '\' name2]);
YY = imrotate(YY,angle,'bicubic','crop');
name3 = char(dicomfiles3(i));
% Read the dicom file:
ZZ= dicomread([pathname3 '\' name3]);
ZZ = imrotate(ZZ,angle,'bicubic','crop');
RR = ZZ - XX;
WW=YY - XX;
SS=imdivide(RR,WW);
SS = imrotate(SS,angle,'bicubic','crop');
SS= imcrop(SS, [200,200,100,100]); %short core 19 12 08
% visualize the dicomfile
figure
imshow(SS)
impixelinfo
% Define the colormap
colormap('jet')
% Define the visualization window
caxis([HUmin HUmax])