Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

zak9001

Member

06-27-2020 06:04 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

Solved! Go to Solution.

Bob_Schor

Knight of NI

06-27-2020 08:48 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

06-27-2020 09:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

Bob_Schor

Knight of NI

06-27-2020 10:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

altenbach

Knight of NI

06-27-2020 12:21 PM - edited 06-27-2020 12:23 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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.)

altenbach

Knight of NI

06-27-2020 12:35 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

@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.

06-27-2020 03:25 PM - edited 06-27-2020 03:26 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

Virus scan in progress. Please wait to download attachments.

06-27-2020 03:28 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

altenbach

Knight of NI

06-27-2020 03:45 PM - edited 06-27-2020 03:46 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

(terminal is right above the indices).

altenbach

Knight of NI

06-27-2020 03:59 PM - edited 06-27-2020 05:29 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

@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.