-
Notifications
You must be signed in to change notification settings - Fork 9
3.4. Run eSRRF analysis using the python package
In this tutorial, we will explore how to perform super-resolution analysis using the eSRRF
function from the nanopyx.methods
module. We'll load an image from user files using the tifffile
library for analysis.
Before we begin, make sure to install the required libraries by running:
pip install nanopyx
To get started, import the eSRRF function from the nanopyx.methods module:
from nanopyx.methods import eSRRF
Next, we'll load an image from the user's files using the "tifffile" library.
import tifffile
# Replace 'path/to/your/image.tif' with the actual path to your image file
image_path = 'path/to/your/image.tif'
image = tifffile.imread(image_path)
Now that we have the eSRRF function and our image loaded, let's perform the eSRRF analysis:
# Set analysis parameters
magnification = 5
radius = 1.5
sensitivity = 1
do_intensity_weighting = True
# Run eSRRF analysis
result = eSRRF(
image,
magnification=magnification,
radius=radius,
sensitivity=sensitivity,
doIntensityWeighting=do_intensity_weighting
)
If you want to visualize or analyze the results further, you can use matplotlib or any other plotting/analysis library of your choice:
import matplotlib.pyplot as plt
# Example: Visualize the eSRRF result
plt.imshow(result, cmap='viridis')
plt.title('eSRRF Result')
plt.colorbar(label='Localization Intensity')
plt.show()
Once you have obtained the eSRRF analysis results, you might want to save them for future reference or additional analysis. We can use the tifffile
library to save the results as a TIFF image.
# Replace 'path/to/save/result.tif' with the desired path to save the eSRRF result
result_path = 'path/to/save/result.tif'
# Save the eSRRF result
tifffile.imsave(result_path, result)
This code snippet saves the eSRRF result to a TIFF file at the specified path. Adjust the result_path variable to the desired location and filename for saving the results.
In this tutorial, you learned how to import the eSRRF function from the nanopyx.methods module, load an input image using the tifffile library, perform eSRRF analysis, and save the results. You can further explore the results using visualization libraries or incorporate them into your analysis pipeline.
Feel free to adapt the code to your specific use case, and don't hesitate to explore additional features offered by nanopyx.
Happy coding!