STIR  6.2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
stir::HUToMuImageProcessor< TargetT > Class Template Reference

A class in the DataProcessor hierarchy that convert from Hounsfield Units to mu-values. More...

#include "stir/HUToMuImageProcessor.h"

Inheritance diagram for stir::HUToMuImageProcessor< TargetT >:
Inheritance graph
[legend]

Public Member Functions

 HUToMuImageProcessor ()
 Default constructor.
 
void set_slope_filename (const std::string &filename)
 set the JSON filename with the slopes
 
void set_manufacturer_name (const std::string &name)
 set the manufacturer name used to select from the JSON entries
 
void set_kilovoltage_peak (const float kVp)
 set the CT kVp used to select from the JSON entries
 
void set_target_photon_energy (const float gamma_energy)
 set the gamma photon energy (in keV) used to select from the JSON entries
 
void apply_scaling_to_HU (TargetT &output_image, const TargetT &input_image) const
 same as apply
 
void set_slope (float a1, float a2, float b1, float b2, float breakPoint)
 set the slope without JSON file
 
- Public Member Functions inherited from stir::RegisteredParsingObject< HUToMuImageProcessor< TargetT >, DataProcessor< TargetT >, DataProcessor< TargetT > >
std::string get_registered_name () const override
 Returns Derived::registered_name.
 
std::string parameter_info () override
 Returns a string with all parameters and their values, in a form suitable for parsing again.
 
- Public Member Functions inherited from stir::DataProcessor< TargetT >
Succeeded set_up (const TargetT &data)
 Initialises any internal data (if necessary) using data as a template for sizes, sampling distances etc. More...
 
virtual void reset ()
 Makes sure we will ignore any previous call to set-up() More...
 
Succeeded apply (TargetT &data)
 Calls set_up() (if not already done before) and process data in-place. More...
 
Succeeded apply (TargetT &out_data, const TargetT &in_data)
 Calls set_up() (if not already done before) and process in_data, putting the result in out_data. More...
 
bool parse (std::istream &f)
 
bool parse (const char *const filename)
 
- Public Member Functions inherited from stir::ParsingObject
 ParsingObject (const ParsingObject &)
 
ParsingObjectoperator= (const ParsingObject &)
 
void ask_parameters ()
 
bool parse (std::istream &f)
 
bool parse (const char *const filename)
 
- Public Member Functions inherited from stir::TimedObject
void reset_timers ()
 reset all timers kept by this object
 
void stop_timers () const
 stop all timers kept by this object More...
 
void start_timers (bool do_reset=false) const
 start all timers kept by this object More...
 
double get_CPU_timer_value () const
 get current value of the CPU timer (since first use or last reset)
 
double get_wall_clock_timer_value () const
 get current value of the wall-clock timer (since first use or last reset)
 

Static Public Attributes

static const char *const registered_name = "HUToMu"
 

Protected Member Functions

void set_defaults () override
 sets default values More...
 
void initialise_keymap () override
 Initialise all keywords.
 
bool post_processing () override
 This will be called at the end of the parsing. More...
 
Succeeded virtual_set_up (const TargetT &image) override
 just checks if all variables are set More...
 
void virtual_apply (TargetT &out_density, const TargetT &in_density) const override
 Performs actual operation (virtual_set_up is called before this function)
 
void virtual_apply (TargetT &density) const override
 Performs actual operation (in-place)
 
- Protected Member Functions inherited from stir::ParsingObject
virtual void set_key_values ()
 This will be called before parsing or parameter_info is called. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::RegisteredParsingObject< HUToMuImageProcessor< TargetT >, DataProcessor< TargetT >, DataProcessor< TargetT > >
static DataProcessor< TargetT > * read_from_stream (std::istream *)
 Construct a new object (of type Derived) by parsing the istream. More...
 
- Static Public Member Functions inherited from stir::RegisteredObject< Root >
static Root * read_registered_object (std::istream *in, const std::string &registered_name)
 Construct a new object (of a type derived from Root, its actual type determined by the registered_name parameter) by parsing the istream. More...
 
static Root * ask_type_and_parameters ()
 ask the user for the type, and then calls read_registered_object(0, type) More...
 
static void list_registered_names (std::ostream &stream)
 List all possible registered names to the stream. More...
 
- Protected Types inherited from stir::RegisteredObject< Root >
typedef Root *(* RootFactory) (std::istream *)
 The type of a root factory is a function, taking an istream* as argument, and returning a Root*.
 
typedef FactoryRegistry< std::string, RootFactory, interfile_lessRegistryType
 The type of the registry.
 
- Static Protected Member Functions inherited from stir::RegisteredObject< Root >
static RegistryTyperegistry ()
 Static function returning the registry. More...
 
- Protected Attributes inherited from stir::ParsingObject
KeyParser parser
 

Detailed Description

template<typename TargetT>
class stir::HUToMuImageProcessor< TargetT >

A class in the DataProcessor hierarchy that convert from Hounsfield Units to mu-values.

This convert HU to mu-values using a piece-wise linear curve. Currently, it supports 2-segment piecewise linear transformations only.

Warning
This does not implement post-filtering to PET resolution, nor resampling to the PET voxel-size.
Parsing from parameter file
The parameters specify a file in JSON format, and the parameters selecting the relevant record.
HUToMu Parameters:=
slope filename := json_filename
; next defaults to GENERIC
manufacturer_name := IN_CAPITALS
; CT tube voltage (defaults to 120)
kilovoltage_peak :=
; gamma energy (defaults to 511 for PET)
target_photon_energy :=
End HUToMu Parameters:=
Format of the slope filename

This file is in JSON format. An example is distributed with STIR. The manufacturer name has to be in capitals. kvp and kev are matched after rounding.

{"scale": {
  "MANUFACTURER": {
    "type": "bilinear",
    "transform": [
      {
        "kvp": 120,
        "kev": 75,
        "a1": 0.16,
        "b1": 1.66e-4,
        "a2": 0.16,
        "b2": 1.48e-4,
        "break": 0
      },
      # more entries like the above
    ]
  }
}
}

This implements the following transformation for every voxel in the image:

\[ \mu = a + b * \mathrm{HU} \]

with $a=a1, b=b1$ if $\mathrm{HI} < \mathrm{break}$, and $a2,b2$ otherwise.

When adding your own entries, you want avoid a discontinuity at the break point.

Member Function Documentation

◆ set_defaults()

template<typename TargetT >
void stir::HUToMuImageProcessor< TargetT >::set_defaults ( )
overrideprotectedvirtual

sets default values

Sets manufacturer_name to "GENERIC", kilovoltage_peak to 120.F, target_photon_energy to 511.F

Reimplemented from stir::ParsingObject.

◆ post_processing()

template<typename TargetT >
bool stir::HUToMuImageProcessor< TargetT >::post_processing ( )
overrideprotectedvirtual

This will be called at the end of the parsing.

Returns
false if everything OK, true if not

Reimplemented from stir::ParsingObject.

◆ virtual_set_up()

template<typename TargetT >
Succeeded stir::HUToMuImageProcessor< TargetT >::virtual_set_up ( const TargetT &  image)
overrideprotectedvirtual

just checks if all variables are set

Todo:
could get manufacturer name, kVp from the image later on, when these become available

Implements stir::DataProcessor< TargetT >.

References stir::error(), stir::info(), and stir::round().


The documentation for this class was generated from the following files: