CT software talk
Transcription
CT software talk
Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München A freeware path to neutron computed tomography Burkhard Schillinger Heinz Maier-Leibnitz Zentrum Technische Universität München, Germany Aaron Craft Idaho National Lab, Advanced Post-Irradiation Examination Department, USA ITMNR-8, Beijing, Sept 1-4, 2016 1 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München • Neutron computed tomography is now being introduced even at smaller and older reactors. • Operators are often faced with a Hen-and-Egg problem: First, they have to show that they can do tomography before they can obtain a budget to build a tomography system. • Building a cheap system first, and using free software, will deliver first results to support a grant application, and give invaluable experience to design a more advanced system. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 2 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München This talk presents • a freeware path for image processing through reconstruction to 3D images • a cheap tomography controller and camera system to obtain first results than can be used for a grant application. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 3 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München The tomography data processing steps are • Preprocessing of images: Removal of gamma spots, subtraction of dark current, normalizing to open beam • Reconstruction: Sorting projection data into sinograms, tomographic reconstruction of image layers • 3D Imaging: Rendering 3D views of the stack of reconstructed layers ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 4 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Professional software for tomographic reconstruction requires a stiff investment. Octopus by InsideMatters for tomographic reconstruction https://octopusimaging.eu/ and VGStudio by VolumeGraphics for 3D rendering http://www.volumegraphics.com/ have been established as a quasi-standard for high-end computed tomography; Octopus has even started its development from neutron computed tomography, so it takes into account several specific requirements for neutron measurements. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 5 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Professional software for tomographic reconstruction requires a stiff investment. Octopus by InsideMatters for tomographic reconstruction https://octopusimaging.eu/ and VGStudio by VolumeGraphics for 3D rendering http://www.volumegraphics.com/ have been established as a quasi-standard for high-end computed tomography; Octopus has even started its development from neutron computed tomography, so it takes into account several specific requirements for neutron measurements. Several packages are available on the web for free; however, these have been developed for X-rays or synchrotron radiation and are not immediately useable for neutron computed tomography. Three reconstruction packages and three 3D-viewers have been identified and used even for Gigabyte datasets. We present the necessary additional preprocessing in ImageJ, some workarounds for bugs in the software, and undocumented or badly documented parameters that need to be adapted for neutron computed tomography. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 6 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München General Image processing: ImageJ from https://imagej.nih.gov/ij/ • Most important: X-ray packages expect a fully illuminated detector, black edges caused by beam limiters are not permitted. These have to be cut off using ImageJ. Load images together with open beam and dark frames to cut the same size. • Run the despeckle noise filter to remove small gamma spots • Save stack according to naming conventions of the reconstruction software, e.g. starting at 0000 or at 0001, with specifix prefixes. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 7 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München CT reconstruction with H-PITRE: https://webint.ts.infn.it/en/research/exp/beats2/h-pitre-beta-version.html H-Pitre is a reconstruction package developed by the Sychrotron ELETTRA in Trieste, Italy. It runs on a NVIDIA Graphics card. • H-PITRE was developed for attenuation and phase contrast measurements at synchrotrons, implying low-contrast samples and parallel beam geometry. For monochromatic parallel beams, 180 degree rotation is sufficient, but for polychromatic radiation and large-contrast samples, a 360 degree scan would be helpful to reduce beam hardening artefacts, however, this is not implemented in H-PITRE. H-PITRE can read 8 and 16 bit integer and 32 bit float data in TIFF, PNG and BMP. It requires a fixed naming and four digits numbering convention starting at 0001 with the names tomo_0001, flat_0001, dark_0001. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 8 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München screenshot of H-PITRE: ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 9 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München H-PITRE runs very fast due to its use of the graphics board and produces accurate results on not-too-strong absorbing samples, but has difficulties with beam hardening since only 180 degrees may be used as rotation range. H-PITRE will do a dark frame and flat field correction, but the center of rotation must be found manually if it deviates from the image center. After converting all projections to sinograms, single slices can be reconstructed. Small semicircles at edges are a sign for incorrect center of rotation; the correct value has to be found manually by trial and error. If the rotation axis is tilted, test slices must be reconstructed at top and bottom of the data set, and with the option ‘dynamic rotation center’ set, the resulting values must be filled into the appropriate fields for ‘RoCenter’. For this, the reconstruction range SinoSN(B-E) must be set to the same value for Begin and End to produce a single slice. The reconstructed stack is saved as 16-bit TIFF. H-PITRE runs very fast due to its use of the graphics board and produces accurate results on not-too-strong absorbing samples, but has difficulties with beam hardening since only 180 degrees may be used as rotation range. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 10 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München CT reconstruction with N-RECON: http://bruker-microct.com/products/downloads.htm Bruker MicroCT sells distributed network licenses of NRECON, but provides a single-workstation license for free, which comes as a server plus a single-client license. With today’s PCs, this software is so fast that no network is required. NRecon was designed to read the data from Bruker MicroCT scanning systems, but can also load 16 bit TIFF images. NRecon was developed for cone beam geometry, but assumes parallel beam geometry for any source-todetector distance greater than ten meters. NRECON does not do dark image and flat field correction; this has to be done in ImageJ before (subtract dark image from projections and open beam, divide projections by corrected open beam). The resulting 32-bit float values must be scaled to 16-bit integer range and converted to 16-bit integer type. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 11 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München CT reconstruction with N-RECON: On reading values produced by ImageJ, NRecon gives an error message declaring an invalid TIFF file. ImageJ introduces a proprietory TIFF tag 50839 (0xc697) for its stack operations; TIFF programming conventions state that unknown TIFF tags should simply be ignored, but since NRecon was only produced for Bruker scanners, it ignores that rule and returns an error. ImageJ provides no way to remove that tag; the simplest way is to read and write the TIFF files with the very fast freeware ‘Advanced Batch Image Converter’, ABIC, from https://sourceforge.net/projects/abic/?source=typ_redirect which simply reads the TIFF files and writes them back with a new header without the proprietory tag. ABIC requires the ending ‘tiff’, so all files must be renamed to ‘.tiff’ first, and after conversion back to ‘.tif’, simply by command line ‘ren *.tif *.tiff’. The very fast processing makes up for the inconvenience. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 12 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München screenshot of N-RECON and its server: ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 13 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München screenshot of N-RECON and its server: NRecon is more tedious to use because of the required preprocessing and image tag removing, but gives more options than H-PITRE and allows for a 360 degree scan, which helps to reduce beam hardening artefacts for strongly absorbing samples. Nrecon requires a four-digit naming and numbering convention starting at zero like ‘name_0000.tif’, as well as a log file with the same name without a number, called ‘name_.log’ that contains all parameters, including the option 180 or 360 degrees. In the reconstruction window, the parameter ‘scales’ must be turned off, or scales will be written at the edges of the reconstructed slices that prevent 3D rendering later on. Output format must be set to ‘TIF(16)’, and in ‘Settings’, ’Misalignment compensation’ should be turned on to correct for a tilted rotation axis. In ‘Start’, this parameter can be tried out in ‘Fine tuning’. There is also an option for beam hardening correction that only consists of a slider, which can only be used by trial and error, since the algorithm may not be fit for neutrons, as the interaction process is very different. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 14 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München This information is provided by Author Anders Kaestner, because his brand new version could not be tested yet: CT reconstruction with MuhRec: http://www.imagingscience.ch/muhrechome/index.html • Was developed with three main goals 1) meeting the needs of neutron imaging reconstruction tasks supporting typical file formats, artefact reduction 2) flexibility to add new processing features 3) To provide GUI to support the configuration • Currently, only parallel beam is supported. Cone beam is under development. • MuhRec can do the whole reconstruction chain from projection to reconstructed slices. • Can be run in GUI mode or from the command line/scripting • MuhRec is free of charge (no license needed anymore), 64-bit binaries can be downloaded for Windows, MacOS, and Ubuntu. • The open source release is under preparation. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 15 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Details, ordered as they came to my mind (Add it if you like): • Handles arbitrary scan angles <180 (with missing wedge errors), 180-360 with correct weighting • Golden ratio angle sequence as hard coded option • Meta data can be added to reconstructed slices • Input file formats: fits, tiff (nexus will come) • Output: tiff (8-, 16-bits, floating point) • Copes with moderate truncation • “Correct” attenuation coefficients – air is = 0 out side the sample, forward projection original projection • Removes retake projection using a list (maybe more relevant for spallation sources) • Performs dose correction • Preprocessing modules - Filtering - Polynomial correction (beam hardening) - Spot cleaning (different approaches, including an untested version of your gamma clean) - Ring cleaning (different approaches) • Processing order can be rearranged • Multithreaded processing with high CPU utilization. • GUI using Qt5 • Viewers to observe projections and reconstructed slices, the later in different orthogonal planes. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 16 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Data configuration Finalizing reconstructed data ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 17 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Projection processing modules can be loaded dynamically, GUI helps to tune. Spot cleaning ITMNR-8, Beijing, Sept 1-4, 2016 Ring cleaning B.Schillinger 18 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Viewing of 3D Data Slices with Bruker DataViewer: http://bruker-microct.com/products/downloads.htm Bruker DataViewer has the same TIFF problem as NRecon and requires removing of the tag in the header; alternatively, it can also read 16 bit PNG images, which ImageJ can also write – but ImageJ’s PNG routine is much slower than the tag removal for TIFF files. DataViewer can slice the reconstructed volume in three directions, and also display three slices together in one 3D image. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 19 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München screenshot of DataViewer: Single slicing in three direction windows ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 20 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München screenshot of DataViewer: Three combined slices in one 3D view ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 21 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München 3D Rendering with Bruker CTVox: http://bruker-microct.com/products/downloads.htm Also Bruker CTVox has the same TIFF problem as NRecon and requires removing of the tag in the header, or loading PNG files. CTVox is very fast and allows manipulation of opacity and brightness. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 22 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München screenshot of CTVox: ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 23 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München 3D Rendering with Slicer: http://www.slicer.org Slicer has started its development in the time of ‘486 computers (then called Dicer) as a commercial product and one of the first powerful 3D programs that could handle data sets larger than the main memory. It was taken over as a freeware research aid by the medical community, with many extensions for treating medical data sets. Slicer is very powerful, but very obviously a system used and always changed by professionals. There is a Wiki documentation, but no manual with the beginner in mind – usage is not always intuitive, and icons not obvious. Therefore, some hard-to-find settings need to be mentioned here to get the beginner started. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 24 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München screenshot of Slicer: ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 25 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München 3D Rendering with Slicer: First, ‘Show text under icons in toolbar buttons’ should be activated in Edit/Application settings/Appearance, which helps a lot to understand the somewhat cryptic icons. If a stack of images is loaded with the standard command ‘load data’, the result will be all images overlaid in the same position in 3D instead of a 3D volume, since Slicer seems to expect position information in the TIFF headers. To avoid this, ‘Show Options’ must be activated in ‘load data’. Then, either a multiple layer TIFF file (as can be produced in ImageJ) can be loaded via ‘Choose File(s) to add’ and ‘ignore orientation’ activated, or a stack of files can be loaded by selecting the first file in a set of TIFFs via ‘Choose File(s) to add’ AND disabled ‘single file’ – this will cause the whole stack to be loaded – AND ‘ignore orientation’ activated. The stack of files will be loaded as a 3D volume, and slices in three directions will be displayed in three separate windows. Size, rotation and thresholds can be varied with the three mouse buttons. To start the actual 3D rendering, the module ‘Volume rendering’ must be loaded from ‘Modules’. There is a tiny Eye symbol left of the active volume name that starts rendering. Fig. 6 shows a screenshot of Slicer with a data set loaded and rendered. Slicer is immensely powerful and offers a load of options and extension modules on the net, but has a steep learning curve, and is not always overly intuitive to use. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 26 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Complete data processing with MuhRec: http://imagingscience.ch/muhrechome/index.html MuhRec is free of charge, but requires a machine-specific license issued by the author Anders Kaestner on request, so it cannot be copied freely. MuhRec can do the whole reconstruction chain from projection to reconstructed slices. At the time of writing, a new version was coming out. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 27 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München screenshot of MuhRec: ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 28 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München A budget tomography controller and camera system A typical neutron imaging detector uses a neutron scintillation screen, a mirror and a cooled CCD camera. For computed tomography, a rotation table for the sample is required, and images must be recorded of multiple angular positions of the sample. Cheap, but good quality cameras (< € 500 to € 1200 ) are available at https://astronomy-imaging-camera.com/ and whole simple systems at http://www.neutronoptics.com/cameras.html but… ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 29 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München …but all these budget cameras do not have a hardware interface (trigger input) to synchronize the rotation table and the camera. Some offer a programming kit, but this is a very tedious path. So you must either control your motor and camera by hand, triggering each for hundreds of images alternately, Image:comfo.ca ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 30 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München …or you can ask your cat to do it for you… Image: Dozens of web pages, no clear origin ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 31 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München …or you can ask a Raspberry Pi with a Gertbot motor controller to do it for you! ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 32 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München To let the Raspberry Pi click your mouse for the camera program, simply solder two wires to the left mouse button, and connect these to the Raspberry Pi. Place the mouse pointer on the trigger button of your camera software on your windows PC, and the Raspberry Pi will control your rotation table, then start an image after each rotation. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 33 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München All components needed for the Raspberry Pi tomography controller ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 34 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München The motor was built into a rudimentary rotation table with a 1:5 reduction, giving 1000 steps per rotation instead of only 500. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 35 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Then, an old desktop radiation monitor from the trash bin was converted into a cheap camera box. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 36 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München Holes were cut, two pocket mirrors were simply glued onto an Aluminium wedge. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 37 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München An optical test pattern was installed. Later, a piece of ZnS(AU,Cu) +LiF scintillation screen was quickly taped onto a paper, and installed for a quick neutron test. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 38 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München The first test with visible light was promising. The gap between the mirrors is visible. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 39 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München The first neutron image was quickly taken between other beam times, just before the conference. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 40 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München The first neutron image was quickly taken between other beam times, just before the conference. The picture is not normalized, white spots are cause by gammas hitting the CCD directly. ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 41 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München The simple setup has a lot of faults as: • Adjustment of camera and mirror • Two mirrors instead of one – the gap is clearly visible • Light reflections on tape etc. inside the box • Crude mechanical work • Bad fixation of the scintillation screen • Mirror holder in the beam So you can do much better than that! Go ahead, and build your own! ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 42 Forschungsneutronenquelle Heinz Maier-Leibnitz (FRMII) Technische Universität München ALL web links for hardware (Raspberry Pi, Gertbot, ZWO camera) and software (H-PITRE, N-Recon, DatViewer, CTVox, Slicer) PLUS text files with detailed instructions as well as the software for the Raspberry controller will be available for download on www.isnr.de/index.php/tools Good luck ! ITMNR-8, Beijing, Sept 1-4, 2016 B.Schillinger 43