Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble recreating numerical propagation results from other DHM tools #6

Open
isConic opened this issue Mar 6, 2023 · 3 comments
Open

Comments

@isConic
Copy link

isConic commented Mar 6, 2023

Problem

I've been using ImageJ's numerical propagation plugin written in Java, The visual results from running Angular spectrum using the same parameters/measurements differ substantially between pyDHM and ImageJ Numerical Prop. The ImageJ output appears to be qualitatively more accurate.

Input Image:

20230110_15_44_54

ImageJ Numerical Propagation (Angular Spectrum) Results

Input Parameters:

wavelength:  409 [nm]  
distance:  1.1  [mm]  
input width:  3.85 [mm]
input height:  2.76 [mm]  

Visual Output

image

pyDHM Numerical Propagation(Angular Spectrum) Results

Input Parameters

wavelength:  409 [nm]  
distance:  1.1  [mm]  
input width:  3.85 [mm]
input height:  2.76 [mm]  

Note: All mm parameters are divided by 1000 to bring to meters.
Note: wavelength is divided by 10^9 (otherwise no visual results) So 409 --> 409/(10.0^9)

Visual Output

image

Code:

mm_to_m = lambda x: x/(10.0**3)
nm_to_m = lambda x: x/(10.0**9)
params = dict(wavelength = nm_to_m(409), 
                       z = mm_to_m(1.01), 
                      dx = mm_to_m(3.85), 
                      dy = mm_to_m(2.76))

image = utilities.imageRead("test_data/plankton.jpg")   

# filter is not applied (Nor is it applied in other Numerical prop tools)  
output = angularSpectrum(image, **params)    

enhanced_output = utilities.intensity(output, False)     

General Question about filters

If I did not wish to apply a visual filter or restrict the ROI and wanted numerical propagation on the full image, Are there any transforms within the sfr, or sfmr that I'm missing outside of it?

@isConic
Copy link
Author

isConic commented Mar 6, 2023

@isConic
Copy link
Author

isConic commented Mar 14, 2023

Does angular spectrum accept unfiltered grayscale image arrays?

@catrujilla
Copy link
Owner

Sorry for getting back to you so late. It has been a busy couple of weeks.

Regarding your first question, the 'sfr' and 'sfmr' are not used in numerical propagations using the angular spectrum method. The propagation units seem not properly inputted to the function call, although it appears to be coded correctly with your 'mm_to_m' and 'nm_to_m'. I cannot identify any other potential issues that could impede proper propagation. The ImageJ numerical propagation plugin code for the angular spectrum and the pyDHM code for the same propagator are the same. The only difference is that ImageJ plugins were developed in JAVA.

Regarding your second question, yes, PyDHM's angular spectrum accepts unfiltered images, including *.jpg files as you are using. However, please try converting the input image file to *.tiff to be 100% sure that this is not the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants