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

2 Ansichten (letzte 30 Tage)
Mehri Mehrnia
Mehri Mehrnia am 22 Jun. 2022
Beantwortet: Walter Roberson am 22 Jun. 2022
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 Kommentare
Walter Roberson
Walter Roberson am 22 Jun. 2022
Why do you need to do that calculation ?
Mehri Mehrnia
Mehri Mehrnia am 22 Jun. 2022
Its a part of bigger algorithim

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Walter Roberson
Walter Roberson am 22 Jun. 2022
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 Kommentar
Mehri Mehrnia
Mehri Mehrnia am 22 Jun. 2022
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.

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 22 Jun. 2022
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.

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by