06-27-2020 06:04 AM
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.
06-27-2020 08:48 AM
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:
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
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
06-27-2020 10:01 AM
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
06-27-2020 12:21 PM - edited 06-27-2020 12:23 PM
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.)
06-27-2020 12:35 PM
@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
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.
06-27-2020 03:28 PM
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
06-27-2020 03:45 PM - edited 06-27-2020 03:46 PM
"Array min&max" will also give you the max values. Just add an indicator. 😉
(terminal is right above the indices).
06-27-2020 03:59 PM - edited 06-27-2020 05:29 PM
@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.