Why are plot titles assigned differently in Windows and MacOS?
Show older comments
Hello,
the following behaviour has been observed running a script for demonstration of a simple iterative CT reconstruction:
In windows, all plot titles are displayed correctly. However, in macOS, some titles are assigned to the previous plot. This has been tested with two different machines (mac Studio and Macbook Air) in two different MATLAB versions (2024b, 2023b).
The behaviour should be reproducible with the following code (running here in browser creates the correct titles):
% Short demo script for iterative reconstruction of a ct image
clearvars;
close all;
ctImage= phantom('Modified Shepp-Logan',256);
figure()
imshow(ctImage)
title("Original Image")
sinogram = radon(ctImage);
[reconstructionLines, projectionAngles] = size(sinogram);
figure()
imshow(sinogram/max(sinogram, [], "all"))
title("Sinogram")
% Iterative reconstruction algorithm
numberOfReconstructionSteps = 180;
angleStepSize = 180/numberOfReconstructionSteps;
tempDifference = zeros(reconstructionLines, 1);
iterativeReconstruction = zeros(reconstructionLines, reconstructionLines);
for i = 1:reconstructionLines
iterativeReconstruction(i,:) = sinogram(i,angleStepSize)/reconstructionLines;
end
figure()
imshow(iterativeReconstruction/max(iterativeReconstruction, [], "all"))
title("First projection")
for i = 1:numberOfReconstructionSteps
iterativeReconstruction = imrotate(iterativeReconstruction, angleStepSize, "bicubic", "crop");
for j = 1:reconstructionLines
tempDifference(j) = sinogram(j,i) - sum(iterativeReconstruction(:,j));
iterativeReconstruction(:,j) = iterativeReconstruction(:,j) + tempDifference(j)/reconstructionLines;
end
figure(4)
imshow(iterativeReconstruction/max(iterativeReconstruction,[],"all"))
end
% Show result and compare to reconstruction by inverse radon transform
figure()
imshow(iterativeReconstruction)
title("Iterative reconstructed image")
reconstructedImage = iradon(sinogram, 0:179);
figure()
imshow(reconstructedImage/max(reconstructedImage, [], "all"))
title("Reconstruction by inverse Radon transform")
The titles i am getting in macOS are:
figure 1: correct title
figure 2: title of figure 3
figure 3 + 4 no title (4 has no title, 3 should have one)
figure 5: title of figure 6
figure 6: no title (there is no figure 7, which could be the title if there were more figures)
Accepted Answer
More Answers (0)
Categories
Find more on Printing and Saving 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!




