Can I apply imtranslate to a 4D image?

조회 수: 3 (최근 30일)
Stelios Fanourakis
Stelios Fanourakis 2018년 7월 3일
댓글: Rik 2019년 7월 8일
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
parvathy prathap
parvathy prathap 2019년 7월 8일
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 2019년 7월 8일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Rik
Rik 2018년 7월 3일
편집: Rik 2018년 7월 3일
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
Stelios Fanourakis
Stelios Fanourakis 2018년 7월 4일
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 2018년 7월 4일
Of course you shouldn't write that line 15 times, that is what for-loops are for.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt J
Matt J 2018년 7월 4일
편집: Matt J 2018년 7월 4일
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
Stelios Fanourakis
Stelios Fanourakis 2018년 7월 15일
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 2018년 7월 15일
@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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 DSP Algorithm Acceleration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by