0

I have an ultrasound function, where for a distance y on a material, it gives cross sectional b-scan which is ultrasound amplitudes (f) for each X coordinate and depth of the material (Z)

[X,Z,f] = function(y)

I need to turn this data into volumetric form for use with contour slice, but I'm not sure how to. I want to plot contourslice at each Y using X,Y,Z,f

Johnathon
  • 165
  • 1
  • 1
  • 6
  • Do you mean you want [multiple discrete `contour(X,Y,f)` plots stacked along the z axis in a 3D plot, being one `contour` for each z=Z](https://stackoverflow.com/questions/24621439/plot-multiple-2d-contour-plots-in-one-3d-figure-matlab)? Or do you need a continuous plot (only the outermost surface would be visible, though)? It might be helpful if you could sketch what your expected output looks like, I think. – Vicky Feb 26 '21 at 04:40
  • @Vicky So I have data of ultrasound, i need X Y and Z to be the x,y and z of the material, so x,y and depth of the material. F is the ultrasound signal. I need multiple contour plots of the b-scans across the material, I can get the ultrasound pulses at each Y distance (sorry I just noticed I said z). I'll edit the original post and try to make it clearer – Johnathon Feb 26 '21 at 05:40
  • My [answer](https://stackoverflow.com/a/35552548/3460361) to a very similar question [How can I plot several 2D image in a stack style in Matlab](https://stackoverflow.com/q/35549733/3460361) should be able to get you on the way. – Hoki Feb 26 '21 at 08:46
  • @Hoki does the same work with contourf plots or does it specifically have to be images? Perhaps I could save contour plots as images and it may work, I'll try it soon. Also can I stack images in x/y instead of z? – Johnathon Feb 26 '21 at 08:54
  • 1
    Well there might be a bit of matrix manipulation but the principle is the same: you have a collection of 2D matrices, you collate them all to form a 3D matrix. The 3D matrix now represent volumetric data. To stack on `xy` plane instead of `z` you can probably use [permute](https://uk.mathworks.com/help/matlab/ref/permute.html) on your 3D matrix. – Hoki Feb 26 '21 at 09:22
  • @Hoki I tried it but it doesn't seem to work with contourslice, it's giving the error that Grid arrays must have NDGRID structure. I can attach the data for you to see but I'm not sure how to – Johnathon Feb 26 '21 at 10:14
  • Try to create an example with simplified data, otherwise it is impossible to understand how your data are arranged and to explain what to do by text only. – Hoki Mar 01 '21 at 10:18

0 Answers0