You are on page 1of 1

% Load the raw list-mode data from the PET scanner

data = loadListmodeData('PETdata.listmode');

% Define the imaging grid for the reconstruction


voxelSize = 2; % mm
imageSize = [128, 128, 64];
imageGrid = ImageGrid(voxelSize, imageSize);

% Define the system model for the PET scanner


systemModel = PETSystemModel(systemParameters);

% Initialize the image volume to a uniform value


imageVolume = ones(imageSize);

% Define the LM-MLEM reconstruction parameters


numIterations = 10;
subsetSize = 10;
tolerance = 1e-6;

% Perform the LM-MLEM reconstruction


for iter = 1:numIterations
subsetIdx = mod(iter-1, subsetSize) + 1;
subsetData = data.getSubset(subsetIdx);
subsetSensitivity = systemModel.calculateSensitivity(imageGrid, subsetData);
updateVolume = subsetSensitivity' * subsetData;
updateVolume = updateVolume ./ (subsetSensitivity' * subsetSensitivity);
imageVolume = imageVolume .* updateVolume;
imageVolume = max(imageVolume, 0);
imageVolume = systemModel.applyNormalization(imageVolume, imageGrid);
diff = norm(subsetData - systemModel.calculateProjection(imageGrid,
imageVolume));
if diff < tolerance
break;
end
end

% Display the reconstructed PET image


imshow(imageVolume(:,:,32), []);

You might also like