.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "demos/04_data/d21_ScannerDataLoader.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_demos_04_data_d21_ScannerDataLoader.py: Load scanner data ================= Read Nikon, Bruker, YXLON, Diondo and Varian datasets. See :doc:`/user-guide/loading-data`. Source: `Python/demos/d21_ScannerDataLoader.py `__ ยท `MATLAB/Demos/d21_ScannerDataLoader.m `__ .. dropdown:: MATLAB version of this demo :icon: code .. literalinclude:: /../MATLAB/Demos/d21_ScannerDataLoader.m :language: matlab This demo is not run when the website is built. .. GENERATED FROM PYTHON SOURCE LINES 17-23 .. code-block:: Python import tigre.utilities.io as tigreio import tigre.algorithms as algs import numpy as np import tigre .. GENERATED FROM PYTHON SOURCE LINES 24-26 Varian onboard CBCT. -------------------- .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: Python ###### TODO .. GENERATED FROM PYTHON SOURCE LINES 30-32 Nikon micro-CT -------------- .. GENERATED FROM PYTHON SOURCE LINES 32-53 .. code-block:: Python # Nikon dataset can be loaded with the following code: datafolder='~/your_data_path/Nikon/Sample_name/' proj,geo, angles = tigreio.NikonDataLoader(datafolder) # as micro-CT datasets are large, optional arguments for loading partial # amount of data is available: # load equidistant angles, but only few: proj, geo, angles = tigreio.NikonDataLoader(datafolder,sampling='equidistant',num_angles=150) # load every X angles (10) proj, geo, angles = tigreio.NikonDataLoader(datafolder,sampling='step',sampling_step=10) # load first X angles (1000) proj, geo, angles = tigreio.NikonDataLoader(datafolder,sampling='continuous',num_angles=1000) # You can directly call reconstruction code now: img=algs.ossart(proj,geo,angles,100) img=algs.fdk(proj,geo,angles) .. GENERATED FROM PYTHON SOURCE LINES 54-56 Brucker Skyscan --------------- .. GENERATED FROM PYTHON SOURCE LINES 56-66 .. code-block:: Python datafolder='~/your_data_path/Bruker/Sample_name/' proj,geo, angles = tigreio.BrukerDataLoader(datafolder) # the same options for sampling and number of angles that exist for Nikon (above) exist for Bruker data loaders. # Sometimes a folder will contain more than one dataset. proj,geo, angles = tigreio.BrukerDataLoader(datafolder,dataset_num='all') # load all of them proj,geo, angles = tigreio.BrukerDataLoader(datafolder,dataset_num=0) # load the first .. GENERATED FROM PYTHON SOURCE LINES 67-69 YXLON ----- .. GENERATED FROM PYTHON SOURCE LINES 69-75 .. code-block:: Python datafolder='~/your_data_path/YXLON/Sample_name/' proj,geo, angles = tigreio.YXLONDataLoader(datafolder) # the same options for sampling and number of angles that exist for Nikon (above) exist for Bruker data loaders. .. GENERATED FROM PYTHON SOURCE LINES 76-78 DICOM data (only tested on Philips Allura) ------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 78-81 .. code-block:: Python ######## TODO .. GENERATED FROM PYTHON SOURCE LINES 82-84 Generic ------- .. GENERATED FROM PYTHON SOURCE LINES 84-116 .. code-block:: Python # It is possible that your scanner is not currently supported, or that it # simply does not have any way of storing the information (Zeiss Xradia # does not store anything but the projections) # if this is the case, the general way of tackling the problem is: # Step 1: define your geometry and angles geo=tigre.geometry() angles = np.linspace(0, 2 * np.pi, 360, endpoint=False) # replace with your scan's angles # Step 2: Load projections: #store in NP array. Use whichever python library will help you get the data loaded. # Step 3: validate tigre.plotproj(proj,angles) # you need to make sure that: # 1) white=metal/bone/high density and black=air. # If this is not the case proj = -np.log(proj / (np.max(proj) + 1)) # Beer-Lambert law # 2) rotation happens left-right instead of top-bottom. # If its top bottom permute your data as required # Step 4: test imgFDK = algs.fdk(proj, geo, angles) tigre.plotimg(imgFDK,dim='z') # If this does not look good, possible things to check: # - Are the angles in the right direction? maybe they need to be inverted. # - Is your geometry properly defined? mistake on geometry will be # detrimental to image quality # - if microCT: halos around the features? COR correction needed. .. _sphx_glr_download_demos_04_data_d21_ScannerDataLoader.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: d21_ScannerDataLoader.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: d21_ScannerDataLoader.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: d21_ScannerDataLoader.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_