Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Adaptive Fourier Filtering

Image Tools


Adaptive Fourier Filtering

OpenInColab

part of

pyTEMlib

a pycroscopy ecosystem package

Notebook by Gerd Duscher, 2023

Microscopy Facilities
Institute of Advanced Materials & Manufacturing
The University of Tennessee, Knoxville

Model based analysis and quantification of data acquired with transmission electron microscopes

Content

An introduction into Fourier Filtering of images.

Install pyTEMlib

If you have not done so in the Introduction Notebook, please test and install pyTEMlib and other important packages with the code cell below.

installing pyTEMlib
done

Loading of necessary libraries

Please note, that we only need to load the pyTEMlib library, which is based on sidpy Datasets.

pyTEMlib version:  0.2026.6.0

Open File

The data are held in the memory in the sidpy format with rather extensive capabilities.

All results can be stored in that NSID format file.

First we select the file and the dataset (the dropdown menu at the bottom), in case there are several.

Loading...
Loading...

Now, we open and plot the selected dataset. Select another one and rerun only cell below (Home button gets you back to original).

Please note that you can zoom and drag the intensity values in the color-bar.

(dict_keys(['Channel_000']), 'C:\\Users\\gduscher\\OneDrive - University of Tennessee\\2026 Experiments\\20260706-CsBrPb RCO\\A1\\0048 - 20260706 5900 x STEM 17 µm.emd')
Loading...
Loading...

Power Spectrum of Image

fft :
	smoothing : 1
	minimum_intensity : 10.122878251923055
	maximum_intensity : 17.86281328568153
source:  p1-3-hr3
Loading...

Spot Detection in Fourier Transform

Change the spot_threshold value slightly up or down (down is more spots)

found 22
Loading...

Adaptive Fourier Filter

Loading...

Let’s see what we did - In Fourier space, of course.

fft :
	smoothing : 1
	minimum_intensity : 10.122878251923055
	maximum_intensity : 17.86281328568153
source:  p1-3-hr3
Loading...

Please note that the spots are ordered from center to outside.

The third parameter of a spot is its angle.

[[-2.62027028  2.21908057 -0.86811058]
 [ 2.62027028 -2.21908057  2.27348207]
 [-3.4226497   0.43880124 -1.44328677]
 [ 3.4226497  -0.43880124  1.69830589]
 [-3.22205484 -1.25371784 -1.94187537]]

Log the result

Save Datasets to file

A convenient function to select a dataset (for further processing, visualization or whatever)

Loading...
{'analysis': 'adaptive fourier filtered', 'spots': array([[-2.62027028, 2.21908057, -0.86811058], [ 2.62027028, -2.21908057, 2.27348207], [-3.4226497 , 0.43880124, -1.44328677], [ 3.4226497 , -0.43880124, 1.69830589], [-3.22205484, -1.25371784, -1.94187537], [ 3.22205484, 1.25371784, 1.19971728], [ 1.31640373, -3.23459202, 2.75508635], [-1.31640373, 3.23459202, -0.38650631], [-2.10624597, -2.80832796, -2.49809154], [ 2.10624597, 2.80832796, 0.64350111], [-3.51040995, 0.33850382, -1.47466498], [ 3.51040995, -0.33850382, 1.66692768], [-0.60178456, -3.48533559, -2.97061654], [ 0.60178456, 3.48533559, 0.17097612], [-2.21908057, -2.93369974, -2.49400159], [ 2.21908057, 2.93369974, 0.64759107], [-4.73905343, 3.67339327, -0.91140362], [ 4.73905343, -3.67339327, 2.23018903], [-5.52889567, -2.36952671, -1.97568811], [ 5.52889567, 2.36952671, 1.16590454], [-0.78984224, -6.0303828 , -3.01135688], [ 0.78984224, 6.0303828 , 0.13023578]]), 'low_pass': 2.0, 'reflection_radius': 0.3}

A tree-like plot of the file

C:\Users\gduscher\Documents\Github\pyTEMlib\example_data\p1-3-hr3-1.hf5
/
├ Measurement_000
  ---------------
  ├ Channel_000
    -----------
    ├ p1_3_hr3
      --------
      ├ metadata
        --------
        ├ experiment
          ----------
      ├ original_metadata
        -----------------
        ├ DM
          --
        ├ DocumentObjectList
          ------------------
          ├ 0
            -
            ├ AnnotationGroupList
              -------------------
              ├ 0
                -
                ├ Font
                  ----
                ├ ObjectTags
                  ----------
            ├ ImageDisplayInfo
              ----------------
              ├ DimensionLabels
                ---------------
              ├ MainSliceId
                -----------
            ├ ObjectTags
              ----------
        ├ DocumentTags
          ------------
        ├ Image Behavior
          --------------
          ├ UnscaledTransform
            -----------------
          ├ ZoomAndMoveTransform
            --------------------
        ├ ImageData
          ---------
          ├ Calibrations
            ------------
            ├ Brightness
              ----------
            ├ Dimension
              ---------
              ├ 0
                -
              ├ 1
                -
          ├ Dimensions
            ----------
        ├ ImageSourceList
          ---------------
          ├ 0
            -
            ├ Id
              --
        ├ ImageTags
          ---------
          ├ Acquisition
            -----------
            ├ Device
              ------
              ├ CCD
                ---
              ├ Configuration
                -------------
                ├ Transpose
                  ---------
            ├ Frame
              -----
              ├ Area
                ----
                ├ Transform
                  ---------
                  ├ Transform List
                    --------------
                    ├ 0
                      -
                      ├ Transpose
                        ---------
              ├ CCD
                ---
              ├ Intensity
                ---------
                ├ Range
                  -----
                ├ Transform
                  ---------
                  ├ Transform List
                    --------------
                    ├ 0
                      -
                    ├ 1
                      -
              ├ Reference Images
                ----------------
                ├ Dark
                  ----
              ├ Sequence
                --------
            ├ Parameters
              ----------
              ├ Base Detector
                -------------
              ├ Detector
                --------
              ├ Environment
                -----------
              ├ High Level
                ----------
                ├ Shutter
                  -------
                ├ Transform
                  ---------
              ├ Objects
                -------
                ├ 0
                  -
                ├ 1
                  -
                ├ 2
                  -
                ├ 3
                  -
          ├ DataBar
            -------
            ├ Custom elements
              ---------------
          ├ Microscope Info
            ---------------
            ├ Items
              -----
              ├ 0
                -
              ├ 1
                -
              ├ 2
                -
        ├ MinVersionList
          --------------
          ├ 0
            -
        ├ Page Behavior
          -------------
          ├ PageTransform
            -------------
        ├ SentinelList
          ------------
        ├ Thumbnails
          ----------
          ├ 0
            -
        ├ UniqueID
          --------
      ├ p1_3_hr3
      ├ x
      ├ y
  ├ Log_000
    -------
    ├ Fourier_Filtered_Image
      ----------------------
      ├ Fourier_Filtered_Image
      ├ metadata
        --------
      ├ x
      ├ y

Close File

let’s close the file but keep the filename

Simulate new notebook

We can now simulate a new notebook and open the file again.

Loading...
Loading...

We want to make an image operation of the images in the file.

Loading...
       subtract
Loading...
Loading...
{'filename': 'C:\\Users\\gduscher\\Documents\\Github\\pyTEMlib\\example_data\\p1-3-hr3.dm3', 'experiment': {'acceleration_voltage': 199990.28125, 'exposure_time': 1.0, 'microscope': 'Libra 200 MC'}}