LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find the maximum value in a 3d array in all three Cartesian planes

Solved!
Go to solution

Hi 

 

I have a 3D array in labview and i would like to find the maximum in each direction. for example the maximum in the XY , XZ and YZ planes.  

 

I was able to find the XY and YZ planes but i dont know how to find the XZ plane.  please see attachment for clarification.

 

Thanks

Zak

 

 

0 Kudos
Message 1 of 18
(1,892 Views)

Your question (to me) seems a little ambiguous, as I am unsure what you mean by "maximum value in a Cartesian plane".

 

Let me illustrate:

  • The 1D question is simple -- given a collection of points on the X axis, what is the maximum of these points?  That is simple, just take the maximum of the points, which will have the maximum X coordinate.
  • Now consider the 2D example.  Given a collection of points in the X-Y plane, what is the maximum of these points?  It depends on what you mean by "maximum".  You can take the maximum in the X direction (by replacing the set of points (xi, yi) by the set (xi) and taking its maximum, but is the answer xi or (xi, yi)?) and also take the maximum in the Y direction, but there are other "measures" you could use such as "distance from the Origin, (0,0)".  You could also define "maximum" as "the radius of the smallest circle that includes all of the points", or some other 2D-related measure.
  • Your 3D example gets even more complex, as you specifically ask for the "maximum in the XY, XZ, and YZ planes".  Do you mean to project the 3D set of points onto the three 2D planes and take some form of 2D maximum?  Do you mean (for the XY case) "What point in the 3D set has the maximum value of Z?" (this is almost a trivial question)?  Do you mean something else?

If you can describe the problem (to yourself) more clearly, I'm confident you can find the answer to it (also by yourself).  Please give it a try, rather than having us "do your thinking for you" (you'll learn much more that way).  Also, please, if you want to attach LabVIEW code, attach LabVIEW code (a file with the extension .vi), not a picture of an aspect of the code (the Block Diagram), analogous to my attaching a picture of a C++ Listing instead of the code, itself.

 

Bob Schor

0 Kudos
Message 2 of 18
(1,864 Views)

Hi 

 

I am working with a 3D ultrasound volume data set like the one shown in the attachment. I would like to project the maximum value or in other words the maximum intensity projection of the top , front and side views, In the XY plane , i project the maximum from Z in depth . In the front YZ plane i project the maximum in the X depth and finally in the side plane XZ i project the maximum in the Y depth. 

 

This was simple to implement in MATLAB and i have been able to do two of the planes on labview but struggling with the XZ plane. If i could rotate the 3D volume by 90 degrees and then take the maximum i think i should be able to get the XZ plane but i am unsure of how to rotate the volume.

 

Thanks

0 Kudos
Message 3 of 18
(1,863 Views)

Oh, it's a 4D plot!  You have a function of 3 variables, X, Y, and Z, and want to know how max(F(X, Y, Z)) varies as a function of x, y, and z, taken one at a time.  This is equivalent to expressing the 3D array representing F(X,Y,Z) as a series of sub-arrays where you fix one variable, say y, to get F(X,y,Z), find the Max of that, and get Max(X,Z) as a function of y.

 

I presume you know how to take a 3D array and extract the XZ plane, right (hint -- use Index Array, choosing the Y component).  I recommend (in the spirit of "generality") that you do the same thing to pull out the XY (Z constant) and YZ (X constant) component and do the three "Extract the Max" using the same (basic) LabVIEW code.  You can check that this means of getting the Maximum Values (for XY and YZ) agrees (or not!) with your previous Matlab-centric method, giving you confidence (or not!) in the XZ question you posed.

 

Please, however, if you need more help, be sure to attach your LabVIEW code, the file that ends in ".vi", not a "picture" of code (though the "picture" of your data certainly helped me to understand the problem!).

 

Bob Schor

0 Kudos
Message 4 of 18
(1,855 Views)

Your 3D array has exactly one global maximum and "array min&max" will give you the three indices, one for each plane.

 

If you want the max in each projection (e.g. the column in each direction with the highest sum, not much more code is really needed.)

0 Kudos
Message 5 of 18
(1,840 Views)

@altenbach wrote:

 

If you want the max in each projection (e.g. the column in each direction with the highest sum, not much more code is really needed.)


Here's how that could look like.

 

altenbach_0-1593279306157.png

 

0 Kudos
Message 6 of 18
(1,834 Views)

Hi Bob 

 

your explanation is exactly what i am looking for! I was able to do this in matlab with the following code: 

 

HILMIP_TOP=squeeze(max(HilbertBscans,[],1));  Done in LabVIEW
HILMIP_SIDE=max(HilbertBscans,[],3);                       Need to do in LabVIEW
HILMIP_FRONT=squeeze(max(HilbertBscans,[],2));    Done in LabVIEW

 

essentially i need to do the equivalent for the side view where i keep one axis constant and find the maximum in that plane but i havent been able to figure out how to do this in labview... 

 

One method that worked was transposing the 3d array but the computation took too long... I assume there is a faster method.... 

 

I have attached my code, its a big VI with alot of stuff , so i added a screenshot to highlight the region of interest.

Download All
0 Kudos
Message 7 of 18
(1,816 Views)

Hi alten 

 

I dont understand whats happening in the example , it seems like the code retrieves the indices rather the maximum projection values? but i suppose i could also extract value rather than indices. I will try play with the code to understand whats happening in a test file. thanks for your help

 

Zak

0 Kudos
Message 8 of 18
(1,813 Views)

 

"Array min&max" will also give you the max values. Just add an indicator. 😉

(terminal is right above the indices).

 

 

 

 

0 Kudos
Message 9 of 18
(1,808 Views)

@zak9001 wrote:

I have attached my code, its a big VI with alot of stuff , so i added a screenshot to highlight the region of interest.


Actually, it has a lot of unnecessary "stuff". Many of your FOR loops can be combined into one (e.g. the first two). "Index array" is resizeable. Why is writing True to "filter completed" inside a loop? Once ought to be enough! I think you can find the filter boundary indices by simple math. No need to threshold into a linear ramp.

 

I really don't like the "Scale object with pane" that you have set for some front panel items.

 

We are missing data and most subVI, so we cannot really play.

0 Kudos
Message 10 of 18
(1,803 Views)