pair-was operation on 3D image(3D matrix)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
Antworten (2)
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.
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.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!