Skip to content

Commit

Permalink
Merge pull request #48 from nikitinvv/master
Browse files Browse the repository at this point in the history
add plane rotation recon
  • Loading branch information
decarlof committed Nov 11, 2021
2 parents 6e5567d + eb2e73f commit 66408e3
Show file tree
Hide file tree
Showing 16 changed files with 565 additions and 182 deletions.
6 changes: 6 additions & 0 deletions iocBoot/iocTomoStream_32ID/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TOP = ../..
include $(TOP)/configure/CONFIG
#ARCH = windows-x64-static
ARCH = linux-x86_64
TARGETS = envPaths dllPath.bat
include $(TOP)/configure/RULES.ioc
2 changes: 2 additions & 0 deletions iocBoot/iocTomoStream_32ID/auto_settings.req
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
file "tomoStream.req", P=$(P), R=$(R)
file "tomoStream_settings.req", P=$(P), R=$(R)
3 changes: 3 additions & 0 deletions iocBoot/iocTomoStream_32ID/autosave/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory contains the save/restore files to retain settings between IOC reboots.
The distribution directory does not contain a auto_settings.sav file, but this will
be created the first time the IOC is run.
36 changes: 36 additions & 0 deletions iocBoot/iocTomoStream_32ID/save_restore.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
### save_restore setup
#
# The rest this file does not require modification for standard use, but...
# If you want save_restore to manage its own NFS mount, specify the name and
# IP address of the file server to which save files should be written.
# This currently is supported only on vxWorks.
#save_restoreSet_NFSHost("oxygen", "164.54.52.4")

# Debug-output level
save_restoreSet_Debug(0)

# Ok to save/restore save sets with missing values (no CA connection to PV)?
save_restoreSet_IncompleteSetsOk(1)
# Save dated backup files?
save_restoreSet_DatedBackupFiles(1)

# Number of sequenced backup files to write
save_restoreSet_NumSeqFiles(3)
# Time interval between sequenced backups
save_restoreSet_SeqPeriodInSeconds(300)

# specify where save files should be
set_savefile_path(".", "autosave")

# specify what save files should be restored. Note these files must be
# in the directory specified in set_savefile_path(), or, if that function
# has not been called, from the directory current when iocInit is invoked
set_pass0_restoreFile("auto_settings.sav")
set_pass1_restoreFile("auto_settings.sav")

# specify directories in which to to search for included request files
# Note cdCommands defines 'startup', but envPaths does not
set_requestfile_path(".", "")
set_requestfile_path(".", "autosave")
set_requestfile_path($(AUTOSAVE), "db")
set_requestfile_path($(TOP), "db")
25 changes: 25 additions & 0 deletions iocBoot/iocTomoStream_32ID/st.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
< envPaths

epicsEnvSet("P", "32id:")
epicsEnvSet("R", "TomoStream:")

## Register all support components

# Use these lines to run the locally built tomoStreamApp
dbLoadDatabase "../../dbd/tomoStreamApp.dbd"
tomoStreamApp_registerRecordDeviceDriver pdbbase

# Use these lines to run the xxx application on APSshare.
#dbLoadDatabase "/APSshare/epics/synApps_6_1/support/xxx-R6-1/dbd/iocxxxLinux.dbd"
#iocxxxLinux_registerRecordDeviceDriver pdbbase


dbLoadTemplate("tomoStream.substitutions")

< save_restore.cmd
save_restoreSet_status_prefix($(P))
dbLoadRecords("$(AUTOSAVE)/asApp/Db/save_restoreStatus.db", "P=$(P)")

iocInit

create_monitor_set("auto_settings.req", 30, "P=$(P),R=$(R)")
6 changes: 6 additions & 0 deletions iocBoot/iocTomoStream_32ID/start_IOC
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Use this line to run the locally built tomoStreamApp
../../bin/linux-x86_64/tomoStreamApp st.cmd

# Use this line to run the xxx application on /APSshare
#/APSshare/epics/synApps_6_1/support/xxx-R6-1/bin/linux-x86_64/xxx st.cmd

1 change: 1 addition & 0 deletions iocBoot/iocTomoStream_32ID/start_medm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
medm -x -macro "P=32id:,R=TomoStream:" ../../tomoStreamApp/op/adl/tomoStream.adl &
6 changes: 6 additions & 0 deletions iocBoot/iocTomoStream_32ID/start_tomostream.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This script creates an object of type TomoStream for doing tomography streaming reconstruction
# To run this script type the following:
# python -i start_tomostream.py
# The -i is needed to keep Python running, otherwise it will create the object and exit
from tomostream.tomostream import TomoStream
ts = TomoStream(["../../db/tomoStream_settings.req","../../db/tomoStream_settings.req"], {"$(P)":"32id:", "$(R)":"TomoStream:"})
6 changes: 6 additions & 0 deletions iocBoot/iocTomoStream_32ID/tomoStream.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file "$(TOP)/db/tomoStream.template"
{
pattern
{ P, R, TOMO_SCAN, IMAGE_P, DARK_PVA, FLAT_PVA, THETA_PVA, RECON_PVA}
{32id:, TomoStream:, 32id:TomoScanStream:, 32id:TomoScanStream:PvaPluginPVPrefix, 32id:TomoScanStream:StreamDarkFields, 32id:TomoScanStream:StreamFlatFields, 32id:TomoScanStream:StreamTheta, 32id:TomoStream:StreamRecon}
}
110 changes: 110 additions & 0 deletions readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
.. _EPICS_NTNDA_Viewer: https://cars9.uchicago.edu/software/epics/areaDetectorViewers.html
.. _ImageJ: https://imagej.nih.gov/ij/

================
TomoStream
================

**tomostream** is Python module for supporting streaming analysis of tomographic data where all pre-processing and reconstruction procedures are performed in real time while images are collected and the rotary stage is moving. **tomostream** provides this main functionality:

- Streaming reconstruction of 3 X-Y-Z ortho-slices through the sample
Expand Down Expand Up @@ -34,3 +38,109 @@ The output of **tomostream** is a live reconstruction diplaying in ImageJ using
:align: center

While the sample is rotating is possible to optimize instrument (alignment, focus, sample to detector distance etc.) and beamline (energy etc.) conditions and monitor the effect live on the 3 orthogonal slices. It is also possible to automatically trigger data capturing based on events occurring in the sample and its environment as a result of segmentation or machine learning.

================
Installation
================

.. _areadetector: https://cars9.uchicago.edu/software/epics/areaDetector.html

The computer performing the tomographic reconstruction must have CUDA/GPU installed. **tomostream** consists of two modules
TomoScanApp and tomostream tools.

TomoScanApp
===========

Provides all the EPICS PVs needed by **tomostream**. To install TomoScanApp follow these steps:

Build a minimal synApps
-----------------------

To build a minimal synApp::

$ mkdir ~/epics
$ cd epics


- Download in ~/epics `assemble_synApps <https://github.com/EPICS-synApps/support/blob/master/assemble_synApps.sh>`_.sh
- Edit the assemble_synApps.sh script as follows:
- Set FULL_CLONE=True
- Set EPICS_BASE to point to the location of EPICS base. This could be on APSshare (the default), or a local version you built.
- For tomostream you only need BUSY and AUTOSAVE. You can comment out all of the other modules (ALLENBRADLEY, ALIVE, etc.)

- Run::

$ assemble_synApps.sh

- This will create a synApps/ directory::

$ cd synApps/support/

- Edit busy-R1-7-2/configure/RELEASE to comment out this line::
ASYN=$(SUPPORT)/asyn-4-32).

- Clone the tomostream module into synApps/support::
$ git clone https://github.com/tomography/tomostream.git

- Edit tomostream/configure/RELEASE to comment out this line::
ASYN=$(SUPPORT)/asyn-4-38

- Edit tomostream/tomoStreamApp/src/Makefile to comment out this line::
tomoStreamApp_LIBS += asyn

- Edit configure/RELEASE add this line to the end::
TOMOSTREAM=$(SUPPORT)/tomostream

- Edit Makefile add this line to the end of the MODULE_LIST::
MODULE_LIST += TOMOSTREAM

- Run the following commands::

$ make release
$ make -sj

Testing the installation
------------------------

- Edit /epics/synApps/support/tomostream/configure
- Set EPICS_BASE to point to the location of EPICS base:
- EPICS_BASE=/APSshare/epics/base-3.15.6

- Start the epics ioc and associated medm screen with::

$ cd ~/epics/synApps/support/tomostream/iocBoot/iocTomoStream
$ start_IOC
$ start_medm


tomostream python tools
=======================

::

$ cd ~/epics/synApps/support/tomostream/
$ python setup.py install

Testing the installation
------------------------

::

$ cd ~/epics/synApps/support/tomostream/iocBoot/iocTomoStream
$ python -i start_tomostream.py




================
Developers
================
Viktor Nikitin (vnikitin@anl.gov)

Francesco De Carlo (decarlo@anl.gov)
15 changes: 15 additions & 0 deletions tomoStreamApp/Db/tomoStream.template
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ record(longout, "$(P)$(R)OrthoZ")
field(HOPR, "2448")
}

record(ao, "$(P)$(R)RotX")
{
field(PREC, "3")
}

record(ao, "$(P)$(R)RotY")
{
field(PREC, "3")
}

record(ao, "$(P)$(R)RotZ")
{
field(PREC, "3")
}

##################################
# Stream status via Channel Access
##################################
Expand Down
3 changes: 3 additions & 0 deletions tomoStreamApp/Db/tomoStream_settings.req
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ $(P)$(R)FilterType
$(P)$(R)OrthoX
$(P)$(R)OrthoY
$(P)$(R)OrthoZ
$(P)$(R)RotX
$(P)$(R)RotY
$(P)$(R)RotZ

##################################
# Stream status via Channel Access
Expand Down

0 comments on commit 66408e3

Please sign in to comment.