An educational tool to get hands-on experience with the k-space and the effects of various modifications on the resulting image after an inverse Fourier transform.
K-space Explorer is written in Python 3 and uses open source libraries so it can be used for free and the source code can be inspected to peek under the hood.
The software has many useful features, such as:
- A modern responsive user interface using Qt
- Automatic Fourier transform to instantaneously visualise changes
- Load your own images and analyse artefacts originating from k-space
- Short explanation for various functions within the software
☕ This app was created in my spare time. If you find it useful please consider buying me a coffee with PayPal ☕
-
You will need to have the following software and packages
- Python 3 (ideally the latest version). Download from the Python 3 homepage.
-
Required Packages for Python 3:
- PyQt5 - provides graphical user interface
- Pillow - opens regular images such as jpg or png
- NumPy - handles FFT transforms and array operations
- pydicom - DICOM format medical image reader
Install via pip by copying the command below to a command prompt (Windows:
Win+R
and typecmd
and press Enter)pip3 install numpy pydicom Pillow PyQt5
-
Download the app and extract it
Navigate to the folder that contains the extracted software and run it by typing the command below
python kspace.py
Alternatively (on Windows)
To save you navigating on Windows, just open the folder where the app was extracted and:
- Click the address bar (the line that looks something like this: "This PC > Downloads > kspace-explorer-master")
- Delete the address and type
cmd
and press Enter - A window should appear, and you can now type
python kspace.py
KSE automatically loads a default image but you can easily switch images by either:
There are various modifiers available to edit the k-space and see the effects on the resulting image. These are accessible from the drawer panel on the right. To access it:
- Click and Drag inwards from the right side of the window
- Press the
Tab
key - Click the round button on the lower right side
You can use the controls in the footer. The footer can be toggled by using the toolbar icon or by hitting F7
- To start or continue the acquisition, press Play/Pause or press
F5
- To rewind press Rewind or press
F4
- You can change the simulation mode with the dropdown box on right-hand side
Your modified images can be saved to your computer by either
Then select the location and the filename. Visual representation of the k-space and the corresponding image will be saved with _k and _i suffixes, respectively.
Please note that if you select the tiff format, k-space image will be saved with 32-bit depth. This not handled well with many image viewers.
To enhance certain parts of the image for viewing it is often useful to change the brightness or contrast of the displays.
- Hold the right mouse button and move up/down to change image or k-space brightness
- Hold the right mouse button and move left/right to change image contrast
With windowing it is possible to limit the displayed image pixel intensity range.
- Drag mouse left/right with middle mouse button pressed to change window width
- Drag mouse up/down with middle mouse button pressed to change window centre
This app was directly influenced by the article of D. Moratal et al. [1], however my aim was to go beyond the functionality that it offers. Several similar software is available for different computing environments. Here is a non-exhaustive list of them:
- k-Space Tutorial (PC, Matlab) [1]
- Journey through k-space (PC, Matlab) [2]
- A k-Space Odyssey (iOS) [3]
- K-Spapp (Android, free) [4]
A screenshot from k-Space Tutorial by D. Moratal et al. |
Matlab is a requirement for many similar apps. Matlab is proprietary software and can be costly to purchase a license. K-space Explorer only uses free software to make it more accessible.
The aim of K-space Explorer is to provide a smooth, modern UI with familiar tools and instant response whenever possible. Updates happen real time so immediate feedback is given for the effect of the changes.
A real-life herringbone artefact and the corresponding k-space |
To get a deeper understanding of the inner workings the code can be inspected. In-line documentation can help understanding the mathematical principles behind various interactions.
- Added k-space Patch tool to eliminate spikes
- RGB DICOMs are not supported
- Accelerated scanning method simulation (SENSE, GRAPPA, POCS)
- Multiple languages
- CLAHE enhancement
This software is not intended for medical use. Even if a scanner original DICOM file is used, the resulting k-space is not equivalent to the scanner raw data as it contains all post-acquisition modifications applied by the scanner software.
Gergely Biró |
[1] Moratal, D., Vallés-Luch, A., Martí-Bonmati, L., & Brummers, M. E. (2008). k-Space tutorial: An MRI educational tool for a better understanding of k-space. Biomedical Imaging and Intervention Journal, 4(1). http://doi.org/10.2349/biij.4.1.e15
[2] Qureshi, M., Kaleem, M., & Omer, H. (2017). Journey through k-space: An interactive educational tool. Biomedical Research (India), 28(4), 1618–1623.
[3] Ridley, E. L. (21/03/2017). Mobile App Spotlight: A k-Space Odyssey. Source: AuntMinnie.com: https://www.auntminnie.com/index.aspx?sec=sup&sub=mri&pag=dis&ItemID=116900&wf=7612
[4] K-Spapp - https://mrapps.jouwweb.nl/