imgH = imgHSV(:, :, 1) * 255;
% We shift the hue to have the greatest value for the nuclei.
- hueShiftValue = 175; % 100
+ hueShiftValue = 175;
imgH = uint8(mod(255 - imgH + hueShiftValue, 256));
imwrite(imgH, '../output/imgH.png')
imgV = uint8(255 - imgHSV(:, :, 3) * 255);
imwrite(imgV, '../output/imgV.png')
- % imgV = uint8(imgHSV(:, :, 3) * 255); % The value component isn't used.
- % imgH = 255 - imgV; % We use the value component instead of the hue one (just for testing)
-
% p. 136: median filter to smooth the noise and
% area closing to enhance the bright objects and make flatter, darker and cleaner the image background.
imgFiltered{1} = mmareaclose(medfilt2(imgH, [5, 5]), 400); % Hue.
sizeDistribution = zeros(redCellMaxSize, 1);
parfor k = 1:redCellMaxSize
- SE = mmsedisk(k, '2D', 'OCTAGON');
+ SE = mmsedisk(k, '2D', 'OCTAGON'); % TODO : tester avec 'euclidean'
imgOpened = mmopen(imgFiltered{2}, SE);
A = funVolume(imgOpened);
N = 1 - A / volImg;
sizeDistribution(k) = N;
end
+ % TODO : voir diff
patternSpectrum = zeros(redCellMaxSize - 1, 1);
for k = 1:redCellMaxSize - 1
patternSpectrum(k) = abs(sizeDistribution(k + 1) - sizeDistribution(k));
end
- % The paper choose the biggest red cell size among the possible red cell sizes. (FIXME)
+ % The paper chooses the biggest red cell size among the possible red cell sizes. (FIXME)
[m, c] = max(patternSpectrum);
- % c = c + 3;
nucleiRadius = 5; % Find a way to extract this information from the pattern spectrum histogram. (FIXME)
bar(patternSpectrum);
% Inputs:
+% THS:
+% c: (TODO: should be the average red cell size)
function [schizonts] = DetectionOfSchizonts(THS, c)
redCellsSE = mmsedisk(c, '2D', 'OCTAGON');
%% Check the Hausdorff distance between each set combination by dilation.
for i = 1:length(sets)
setA = sets{i};
+ if isempty(setA)
+ continue
+ end
dilatedSetA = mmdil(setA, redCellsSE);
for j = 1:length(sets)
setB = sets{j};
- if setB == setA
+ if isequal(setB, setA) || isempty(setB)
continue
end
- if (dilatedSetA & setB) == setB %#ok<AND2> % If B is a subset of A -> there are both in a Hausdorff distance of 2*c.
+ if (dilatedSetA & setB) == setB % If B is a subset of A -> there are both in a Hausdorff distance of 2*c.
schizonts = schizonts | setA | setB;
+ sets{i} = [];
+ sets{j} = [];
end
end
end