LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does NI offer 3D deconvolution?

For deconvolution, wrap-around errors can occur if the arrays are not padded (FFTs assume that the array is joined at opposite edges).  As far as I can tell, the image should be mirrored (reflected at the boundaries) by at least the width of the PSF (non-zeros only), while the PSF should be zero-padded to fill an array of the same size.

As far as FFT speeds go, there are huge variations (e.g. array sizes of 1438 and 1439 are almost 50 times slower than 1440!).  In general, powers-of-two are faster than most others, but it's often not worth making the array much larger than it needs to be (especially once you start doing 3D FFTs).  I've run this VI to compute the speeds of different size FFTs and have created a list of "Fast FFT sizes" that I pad to for my machine - your results may vary.  One result is that an array just larger than 512 is much faster to pad to 576 rather than 1024, plus using much less memory.

Cheers ~ Greg

Message 21 of 58
(1,759 Views)
Very interesting.  I wonder if such errors could be responsible for the strange behavior I see in another situation seen for another situation.  I attach another VI here with both the options for the straight deconvolution method and the weiner method.  In this VI, I have a terahertz (similar to xray) image and associated PSF for the terahertz system.  I would expect a deblurring from the deconvolution process but I am getting unexpected results with both options.  The image and PSF are hardcoded as defaults here so no images need to be loaded. Do you have any comment here?

Sincerely,

Don
Message 22 of 58
(1,754 Views)
I'm not sure I quite understand what you're doing here.  Looks like you have a 1D signal, and a 2D PSF - is that right?  Perhaps you could try a 1D deconvolution using a 1D PSF?  Otherwise, I'm pretty sure that your 2D images will need to have the same dimensions.

Cheers ~ Greg

Message 23 of 58
(1,748 Views)
ps. As I understand what you have stated above (the PSF should be zero-padded to fill an array of the same size [as the image?]), I forgot to mention that an error code does not occur in the LabVIEW 2D inverse FFT after division even though the PSF and Image do not have the same dimensions.  I did, however, see an error using the Vision 2D inverse FFT after division......Don
Message 24 of 58
(1,743 Views)
Yeah, somehow the array dimensions got screwed up (I don't know how the second dimension became only 1 on the image) so I have reposted with my ps. (but you replied too fast!) so I did not get to repost until after your reply.  So based on what you are saying, I am going to zero pad to make sure we have identical dimensions for image and PSF, and see what happens....Don
Message 25 of 58
(1,744 Views)
Sorry about that - the new code looks better.  Your problem is just that the arrays are different sizes.  Center each one in a 200x200 array of zeros (i.e. zero-padding) and the deconv seems to work, although the PSF is close enough to a point source that it may not make much difference.
Message 26 of 58
(1,742 Views)

I had some time this morning and I wrote a small routine that pads dimensions with the PSF minimum value (rather than zero) thinking that that allows us to potentially skip the Weiner formulation if not needed.  I padded only to the minimum number needed, and in fact the routine can have dimensions off by 1 (indeed that is the case in this example) but the result seems to be valid.  This can likely be tweaked and optimized but it was a simple solution for now.  So yes, it does appear that the dimensions are required to be (about) equal to allow us to carry out the deconvolution.  Thanks again for taking the time to look at all of this and making great suggestions.

Sincerely,

 

Don

Message 27 of 58
(1,725 Views)
Hi,
 
I am in a similar situation as some of the other users in this forum, i.e. quite new to the business of deconvoluting images. I have played a little witht the Labview 7.2 2D FFT VIs. In one example I use FFT on an image followed by multiplication with a PSF (Gaussian curve) and finally Inverse FFT. The result is what I expect however the four quadrants are rotated in the resulting image. I saw that you use a "Swap Quadrants" sub Vi, which solves the problem. Do you have any idea what is causing this and/or how to avoid it?
 
Another more general question. Our institute is using LabView 7.2 but we have a license for version 8.2. Can I have both Labview versions installed on my laptop so that I can open the example Vi's that are posted on this site but still develop code that can be used on other machines (using Labview 7) at the Centre?
 
Cheers, TT
0 Kudos
Message 28 of 58
(1,370 Views)
Hi All,

There is a rule-of-thumb when determining the constant in the
denominator in the pseudo-inverse filter (about half of the literature
refers to this function as the Wiener filter even though it is an
approximation. Using "pseudo-inverse" filter avoids this confusion.)
Use C2 * MeanOf( Abs(FFT(PSF))) where C2 starts at 0.01. I have found
that this is typically the correct answer.


By the way, Tria Image Processing, found at http://quarktet.com/Tria.html
has a built-in pseudo-inverse filter, as well as tools that allow easy
cleaning of the PSF before processing. Currently the program
deconvolves only one image at a time (in a couple of seconds), but we
will be adding batch processing soon.

Best Regards,
Jim C


0 Kudos
Message 29 of 58
(1,359 Views)

You CAN use both versions of LabVIEW on your machine at the same time.

 

The 'swap quadrants.vi' is needed to reposition the results so that the deconvolution results display properly.

 

Sincerely,

 

Don

0 Kudos
Message 30 of 58
(1,358 Views)