Overlap two 2D array images by coordinate mapping
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm doing pixel-by-pixel analysis. I have one parametric image, img1, and one parametric ROI matrix image (contains only values within the ROI and is zero elsewhere), img2, with resolutions 256x256 that I'm trying to overlap What I've got at my disposal are:
- The two image arrays, img1 and img2, that have the same FoV extent, but are shifted and covers different areas.
- Real world reference points (in mm) for both images, which are refpoint1=(-88.5,-98.6) and refpoint2=(-86.1,-96.7), respectively for img1 and img2. The reference points are located in the top left pixel (1,1) in their respective images.
- Pixel spacing for both images, which is 1.42 pixel/mm.
I want to shift img2 to overlap on img1 by coordinate mapping.
Attempt
temp = zeros(size(img1));
s = size(img2);
x = abs(refpoint1(1) - refpoint2(1)) * pixspacing;
y = abs(refpoint1(2) - refpoint2(2)) * pixspacing;
temp(x:x+s(1)-1, y:y+s(2)-1) = img2;
Close solution
x = (refpoint1(1) - refpoint2(1)) * pixspacing;
y = (refpoint1(2) - refpoint2(2)) * pixspacing;
img2 = imtranslate(img2, [x, y], 'FillValues', 0, 'OutputView', 'full');
The problem now is that the ROI images are aligned and do overlap with each other, but I can't perform the operation img1 .* img2 since img2 is of different resolution than img1. How can I crop img2 and keep it aligned?
0 Kommentare
Antworten (1)
Image Analyst
am 22 Sep. 2018
and
You may have to use imtranslate() or imregister() if they're not aligned in the way you want.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!