pair-was operation on 3D image(3D matrix)

조회 수: 2 (최근 30일)
Mehri Mehrnia
Mehri Mehrnia 2022년 6월 22일
답변: Walter Roberson 2022년 6월 22일
I have 3D image, in fact it's slices of heart which is a 3D matrix(i.e N=640*640*64). I want to do an operation such as asb(diff) on all two-pixel combinations. it has N*N/2 computation. what is the best way to do it?
the max memory that I can use 100Gb, so the linear long vector computations is not possible.
  댓글 수: 2
Walter Roberson
Walter Roberson 2022년 6월 22일
Why do you need to do that calculation ?
Mehri Mehrnia
Mehri Mehrnia 2022년 6월 22일
Its a part of bigger algorithim

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

답변 (2개)

Walter Roberson
Walter Roberson 2022년 6월 22일
findgroups() on the image. You probably are using uint8 so at most 256 different groups. Record the second output of findgroups() as well -- the unique associated values.
Now,
t = double(unique_values);
unique_diffs = abs(t - t.');
G3d = reshape(Group_IDs, size(YourImage)); %640 x 640 x 64 array of group numbers
At this point, to know what the absolute difference is betweeen YourImage(J1,K1,L1) and YourImage(J2,K2,L2) do
G1 = G3d(J1, K1, L1);
G2 = G3d(J2, K2, L2);
needed_difference = unique_diffs(G1, G2);
That is, all of the unique differences are pre-computed, you look up the indices, and you use the indices to look up the pre-computed results.
But frankly, if you were going to bother with this approach, you might as well just compute the values on the fly.
  댓글 수: 1
Mehri Mehrnia
Mehri Mehrnia 2022년 6월 22일
Thanks for the answer. The pixel values are not in uint8 as they show dosage of Gd even can be 800 or ...
I don't deal with just unique values, so every single pair sampling is important.
and also I need to record all values as I then use the "histcount" after all.

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


Walter Roberson
Walter Roberson 2022년 6월 22일
You need to give up on the algorithm. If you were able to represent the results with one byte each, you would need 343597383680000 bytes of memory (but you need a minimum of 9 bits per entry, not 8 bits). 343597383680000 is more than 2^48 bytes of memory. The maximum amount of memory that can be addressed by any publicly known implementation of the x64 architecture is 2^48 bytes. Therefore your algorithm is requiring that you use an array larger than what can possibly be handled by any x64 architecture computer.
Although x64 is a 64 bit architecture, on all publicly known implementations, only 48 address bits are defined. This is a hard limit -- not only would you have to find all of that memory but you would have to get a custom CPU designed for it, and a custom operating system, and a custom MATLAB to run on that system.
Give up. This is not something you can accomplish.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by