Can I apply imtranslate to a 4D image?

1 Ansicht (letzte 30 Tage)
Stelios Fanourakis
Stelios Fanourakis am 3 Jul. 2018
Kommentiert: Rik am 8 Jul. 2019
Can you please give me examples of imtranslate code lines that is being applied to a 4D DICOM image?
I get the errors that imtranslate is taking a 3D image as input.
  6 Kommentare
parvathy prathap
parvathy prathap am 8 Jul. 2019
Thanks for your answer. Plenoptic OR light field images are theoretically considered to be 4 D images. I have seen a couple of datasets of light field images where the images are in png format or tiff format. That is why i was wondering if light field images could be available in these formats too. Please let me know if you know anyone working in the field of light field/plenoptic image processing. I am new to this field.
Rik
Rik am 8 Jul. 2019
They may be 4D theoretically, but if they're saved as png, they are RGB 2D. Tiff has a some more options, although as I understand it is also limited to 3D. Just like a map of the world, that could be a lower dimensional representation of the higher dimensional actual object.
The fundamental question of how you would display a 4D object is also still unanswered.
And no, I don't know anyone working in such a field.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Rik
Rik am 3 Jul. 2018
Bearbeitet: Rik am 3 Jul. 2018
The code below implements what I mentioned in my comment. It might also be the case that your 4D is actually a 3D in the same format as in the mri.mat example bundled with the IPT. In that case, you could simply have used squeeze.
S=load('mri');%load a builtin 3D example
IM=repmat(squeeze(S.D),1,1,1,10);%generate a 4D
translation_vector=[13 40 -1 2];
IM2=imtranslate(IM(:,:,:,1),translation_vector(1:3));
for n=2:size(IM,4)
IM2(:,:,:,n)=imtranslate(IM(:,:,:,n),translation_vector(1:3));
end
if translation_vector(4)~=0
IM2b=imtranslate(squeeze(IM2(1,:,:,:)),[0 0 translation_vector(4)]);
IM2b=permute(IM2b,[4 1 2 3]);
for n=2:size(IM2,1)
IM2b(n,:,:,:)=imtranslate(squeeze(IM2(n,:,:,:)),[0 0 translation_vector(4)]);
end
IM2=IM2b;
end
  12 Kommentare
Stelios Fanourakis
Stelios Fanourakis am 4 Jul. 2018
I cannot write imtranslate line 15 times. What about if I had 100 or 200 or even more images and what about if it happened to be changed. Any other way to do it? The positions will be fixed and if images are changed the new ones will be displaced the same.
Rik
Rik am 4 Jul. 2018
Of course you shouldn't write that line 15 times, that is what for-loops are for.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Matt J
Matt J am 4 Jul. 2018
Bearbeitet: Matt J am 4 Jul. 2018
Another possibility below. This should work on arrays of any dimension.
F=griddedInterpolant(your4Darray);
g=F.GridVectors;
for i=1:numel(g)
g{i}=g{i}-translation_vector(i);
end
result=F(g);
  20 Kommentare
Stelios Fanourakis
Stelios Fanourakis am 15 Jul. 2018
I have another assumption. im2 is a 4D interpolated stack of images (stack out of 15 images) using interp3.
Interpolation to me, means that it creates in between images. For example, if there is 1 to 2 image, the interpolation will give us 1.5 image. Am I correct? So that's what interp3 does. It increases the number of images above 15, where they really are.
Then, by importing im2 to GriddedInterpolant, again another interpolation takes place, so even more subimages are created. Thus, the total number of slices that consist the stack may exceed 30, but, definitely it won't be 15 where it started.
Then, with GridVectors I turn it to cell array and by multiplying with the translation_vector, supposedly they are shifted. BUT, the translation_vector matrix is consisted out of 15 rows and 2 columns. 15 rows as the original images NOT the interpolated ones. So, a lot of images do not shift.
Am I right to my assumption. Is this more clear so we can find a solution?
Stelios Fanourakis
Stelios Fanourakis am 15 Jul. 2018
@Matt. I though of another solution. When I use result = F(g) I apply interpolation again to g which are the original set points (image) multiplied by translation_vector.
That means that the original image has already been shifted plus a new interpolation coming on the way (F(g)). Does it make it somehow to be smushed or squeezed?
If I visualize with only g without F(g) I get errors later on to the uicontrol of the slider (e.g. Index Exceeds Matrix Dimensions).
Would it be correct to visualize only with g?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by