how to fuse 2 set data different length frame

2 次查看(过去 30 天)
Hi all, i have 60 image SPECT, and 193 Image CT. how to fuse it? which different length frame/slice.
i use imfuse but failed.
anyone can help me?
clc
clear all
% Get a list of all files in the folder with the desired file name pattern.
myFolder = 'C:\Users\Akmal\Downloads\phantom IEC, weight 12.8 kg-20210104T080816Z-001\phantom IEC, weight = 12.8 kg\xQuant\xquant';
filePattern = fullfile(myFolder, '*.dcm'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for K = 1 : length(theFiles)
baseFileName = theFiles(K).name;
fullFileName = fullfile(theFiles(K).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
N(:,:,K) = dicomread(fullFileName);
scale = 256/103 ;
Pi(:,:,K) = imresize(N(:,:,K),scale) ; % where P is your 103*103 3D matrix
end
% Get a list of all files in the folder with the desired file name pattern.
myFolder = 'C:\Users\Akmal\Downloads\phantom IEC, weight 12.8 kg-20210104T080816Z-001\phantom IEC, weight = 12.8 kg\xQuant\xquant\ct';
filePattern = fullfile(myFolder, '*.dcm'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for L = 1 : length(theFiles)
baseFileName = theFiles(L).name;
fullFileName = fullfile(theFiles(L).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
M(:,:,L) = dicomread(fullFileName);
end
imfuse2(Pi, M);

回答(1 个)

prabhat kumar sharma
Hi Akmal,
I understand that you are directly trying to fuse 3D Volumes with mismatched dimensions.
When fusing SPECT and CT images with different slice counts:
1. Resample : the images so they have the same resolution and dimensions. Use interpolation to match the slice thickness and dimensions.
2. Align : The images using image registration techniques to ensure they are spatially correspondent.
3. Fusion : can then be performed on a slice-by-slice basis if needed, using techniques suitable for your analysis or visualization goals.
Since `imfuse` doesn't directly support 3D volume fusion or differing slice counts, focus on preprocessing steps first (resampling and alignment). For actual fusion, consider using slice-by-slice operations if visualization is the goal, or look into more advanced 3D volume fusion techniques for analysis purposes.
% Assuming Pi and M are your SPECT and CT volumes respectively
% And assuming both have been resampled/interpolated to the same dimensions
% Initialize a fused volume array based on the dimensions of the resampled volumes
% Here, assuming Pi and M have been made to match in dimensions
fusedVolume = zeros(size(Pi));
% Loop through each slice to fuse them
% Assuming Pi and M have the same number of slices after resampling
for i = 1:size(Pi, 3)
fusedSlice = imfuse(Pi(:,:,i), M(:,:,i), 'blend', 'Scaling', 'joint');
fusedVolume(:,:,i) = fusedSlice; % This line will throw an error because imfuse returns an RGB image, You would need to handle the RGB nature of fusedSlice or adjust your approach.
end
I hope it helps!

Community Treasure Hunt

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

Start Hunting!

Translated by