tomwer.core.scan.edfscan.EDFTomoScan#

class tomwer.core.scan.edfscan.EDFTomoScan(scan, overwrite_proc_file=False, update=True)#

Class used to represent a tomography acquisition with hdf5 files.

Parameters:

scan – path of the scan

clear_caches()#

clear caches. Might be call if some data changed after first read of data or metadata

data_flat_field_correction(data, index=None)#

Apply the flat field correction on the given data.

Parameters:

data – radio to correct

Return numpy.ndarray:

corrected data

static directory_contains_scan(directory, src_pattern, dest_pattern)#

Check if the given directory is holding an acquisition

Parameters:
  • directory – directory we want to check

  • src_pattern – buffer name pattern (‘lbsram’)

  • dest_pattern – output pattern (‘’). Needed because some acquisition can split the file produce between two directories. This is the case for edf, where .info file are generated in /data/dir instead of /lbsram/data/dir

Returns:

does the given directory contains any acquisition

static from_identifier(identifier)#

Return the Dataset from a identifier

getDark()#

For now only deal with one existing dark file.

Returns:

image of the dark if existing. Else None

getFlat(index=None)#

If projectionI is not requested then return the mean value. Otherwise return the interpolated value for the requested projection.

Parameters:

index (int | None) – index of the projection for which we want the flat

Returns:

Flat field value or None if can’t deduce it

get_identifier()#

return the dataset identifier of the scan. The identifier is insure to be unique for each scan and allow the user to store the scan as a string identifier and to retrieve it later from this single identifier.

static get_index_reconstructed(reconstructionFile, scanID)#

Return the slice reconstructed of a file from her name

Parameters:

reconstructionFile – the name of the file

get_nabu_dataset_info(binning=1, binning_z=1, proj_subsampling=1)#
Returns:

nabu dataset descriptor

static get_process_file_name(scan)#
get_proj_angle_url(use_cache=True, *args, **kwargs)#

retrieve the url for each projections (including the alignment / return one) and associate to each (if possible) the angle. Alignment angle are set as angle (1) to specify that this is an alignment one. :type use_cache: bool :param use_cache: :return: dictionary with angle (str or int) as key and url as value

static get_reconstructions_paths(scanID, withIndex=False)#

Return the dict of files: * fitting with a reconstruction pattern and ending by .edf * .vol files

Parameters:
  • scanID – is the path to the folder of acquisition

  • withIndex – if False then return a list of slices otherwise return a dict with the index of the slice reconstructed.

get_sinogram(line, subsampling=1, norm_method=None, **kwargs)#

extract the sinogram from projections

Parameters:
  • line – which sinogram we want

  • subsampling – subsampling to apply on the sinogram

Returns:

sinogram from the radio lines

static guess_index_frm_EDFFile_name(_file)#
static is_tomoscan_dir(directory, dataset_basename=None, src_pattern=None, dest_pattern=None, **kwargs)#

Check if the given directory is holding an acquisition

Parameters:

directory (str) –

Return type:

bool

Returns:

does the given directory contains any acquisition

load_from_dict(desc)#

Load properties contained in the dictionary.

Parameters:

_dict – dictionary to load

Returns:

self

Raises:

ValueError if dict is invalid

projections_with_angle()#
scan_basename()#

return basename of the directory containing the acquisition

Return type:

str | None

scan_dir_name()#

return name of the directory containing the acquisition

Return type:

str | None

scan_parent_dir_basename()#

return parent basename of the directory containing the acquisition

Return type:

str | None

to_dict()#
Returns:

convert the TomoScanBase object to a dictionary. Used to serialize the object for example.

to_nabu_dataset_analyser()#

Return the equivalent DatasetAnalyzer for nabu

update()#

update list of radio and reconstruction by parsing the scan folder

property working_directory#

working directory to use for this scan (for launching reconstruction for example)