0
$\begingroup$

Most of the pixels in this image are black, but Image3D displays them as transparent. That's actually good for my application, but it is unexpected without an alpha channel. The main problem is getting a good rendering in 3D. In 2D, analogous images are crisp and colorful (2nd image).

I'm in Win10, mma 12, i7-4790K, 32G, NVIDIA Quadro 4000.

(* This takes 20 minutes to run *)

a = 0;
b = 0;
c = 0;
d = 0;
e = 0;
f = 0;
g = -.5;
h = 1.5;

bckx =.;
bcky =.;
bckz =.;
sum =.;

tup = tupstart = Tuples[{a, b, c, d, e, f, g, h},
    3];

bckx = RandomReal[{0, 0}, {532, 532, 532, 3}];
bcky = RandomReal[{0, 0}, {532, 532, 532, 3}];
bckz = RandomReal[{0, 0}, {532, 532, 532, 3}];

For[k = 1, k <= 512, k++, bckx[[All, All, k]] = tup[[k]]];
For[j = 1, j <= 512, j++, bcky[[All, j, All]] = tup[[j]]];
For[i = 1, i <= 512, i++, bckz[[i, All, All]] = tup[[i]]];

sum = bckx + bcky + bckz;

For[i = 1, i <= 532, i++, 
  For[j = 1, j <= 532, j++, For[k = 1, k <= 532, k++,
    If[((0 > sum[[i, j, k, 1]]) || (sum[[i, j, k, 1]] > 1) ||
       (0 > sum[[i, j, k, 2]]) || (sum[[i, j, k, 2]] > 1) ||
       (0 > sum[[i, j, k, 3]]) || (sum[[i, j, k, 3]] > 1)),
     ( sum[[i, j, k, 1]] = 
       sum[[i, j, k, 2]] = sum[[i, j, k, 3]] = 0)]]]];

Image3D[sum]

Image3D

2D slice

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.