1
$\begingroup$

Let's suppose I have created a 3d image of gray scale Images with:

image3d = Image3D[Table[readImage[i], {i, numberOfImages}]];

and

image3dSlices = Image3DSlices[image3d]

To show the 3d image I can use:

image3d 

or

Image3D[image3dSlices[[startImageNumber;;endImageNumber]]]

Is it somehow possible to convert the image data so that I could use ListPlot3D or ListDensityPlot3D? Please see also here:

$\endgroup$
  • 1
    $\begingroup$ ListDensityPlot[ImageData@image3dSlices[[imageNumber]]] and ListPlot3D[ImageData@image3dSlices[[imageNumber]]]? $\endgroup$ – kglr Oct 10 '17 at 13:10
  • $\begingroup$ @kglr: Thank you. But how could I use e.g. ListPlot3D for all the images at once? $\endgroup$ – mrz Oct 10 '17 at 13:20
  • $\begingroup$ ListPlot3D[ImageData/@image3dSlices]? $\endgroup$ – kglr Oct 10 '17 at 13:45
1
$\begingroup$

your linked example looks to be essentially binary. Maybe something like this is what you are after?

img = Image3D[
  Table[ SparseArray[
     Rule[#, 1] & /@ 
      Round@CirclePoints[{10, 10}, (81 - (i - 10)^2)/20, 100] ,
      {20,20}] // Normal, {i, 19}]]

enter image description here

 ListPointPlot3D[Position[ImageData[img], 1., {3}]]

enter image description here

If your data isnt exactly binary maybe some threshold will work eg.

ListPointPlot3D[Position[ImageData[img], x_Real /; x > .1, {3}]]
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you. I was looking for this kind of solution. $\endgroup$ – mrz Oct 11 '17 at 8:33
1
$\begingroup$

Perhaps

slices = Image3DSlices[ExampleData@{"TestImage3D", "CTengine"}];
Row[{Show[slices[[14]], ImageSize -> 300], 
  ListDensityPlot[ImageData@slices[[14]], ImageSize -> 300],
  ListPlot3D[ImageData@slices[[14]], ImageSize -> 300]}, Spacer[10]]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ This solution is very helpful to plot the single image slices and be able to control the axes ranges (ticks). Great. $\endgroup$ – mrz Oct 11 '17 at 4:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.