STIR 6.5.0
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 >:

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.
virtual void reset ()
 Makes sure we will ignore any previous call to set-up().
Succeeded apply (TargetT &data)
 Calls set_up() (if not already done before) and process data in-place.
bool parse (std::istream &f)
Public Member Functions inherited from stir::ParsingObject
 ParsingObject (const ParsingObject &)
ParsingObject & operator= (const ParsingObject &)
bool parse (std::istream &f)
bool parse (const char *const filename)
void ask_parameters ()
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
void start_timers (bool do_reset=false) const
 start all timers kept by this object
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

Protected Member Functions

void set_defaults () override
 sets default values
void initialise_keymap () override
 Initialise all keywords.
bool post_processing () override
 This will be called at the end of the parsing.
Succeeded virtual_set_up (const TargetT &image) override
 just checks if all variables are set
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
virtual void set_key_values ()
 This will be called before parsing or parameter_info is called.

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.
Static Public Member Functions inherited from stir::RegisteredObject< DataProcessor< TargetT > >
static DataProcessor< TargetT > * 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.
static DataProcessor< TargetT > * ask_type_and_parameters ()
 ask the user for the type, and then calls read_registered_object(0, type)
static void list_registered_names (std::ostream &stream)
 List all possible registered names to the stream.
Protected Types inherited from stir::RegisteredObject< DataProcessor< TargetT > >
typedef DataProcessor< TargetT > *(*) 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_less > RegistryType
 The type of the registry.
Static Protected Member Functions inherited from stir::RegisteredObject< DataProcessor< TargetT > >
static RegistryType & registry ()
 Static function returning the registry.
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.

Constructor & Destructor Documentation

◆ HUToMuImageProcessor()

template<typename TargetT>
stir::HUToMuImageProcessor< TargetT >::HUToMuImageProcessor ( )

Default constructor.

References HUToMuImageProcessor(), and set_defaults().

Referenced by HUToMuImageProcessor().

Member Function Documentation

◆ set_slope_filename()

template<typename TargetT>
void stir::HUToMuImageProcessor< TargetT >::set_slope_filename ( const std::string & filename)

set the JSON filename with the slopes

References set_slope_filename().

Referenced by set_slope_filename().

◆ set_manufacturer_name()

template<typename TargetT>
void stir::HUToMuImageProcessor< TargetT >::set_manufacturer_name ( const std::string & name)

set the manufacturer name used to select from the JSON entries

References set_manufacturer_name().

Referenced by set_manufacturer_name().

◆ set_kilovoltage_peak()

template<typename TargetT>
void stir::HUToMuImageProcessor< TargetT >::set_kilovoltage_peak ( const float kVp)

set the CT kVp used to select from the JSON entries

References set_kilovoltage_peak().

Referenced by set_kilovoltage_peak().

◆ set_target_photon_energy()

template<typename TargetT>
void stir::HUToMuImageProcessor< TargetT >::set_target_photon_energy ( const float gamma_energy)

set the gamma photon energy (in keV) used to select from the JSON entries

References set_target_photon_energy().

Referenced by set_target_photon_energy().

◆ apply_scaling_to_HU()

template<typename TargetT>
void stir::HUToMuImageProcessor< TargetT >::apply_scaling_to_HU ( TargetT & output_image,
const TargetT & input_image ) const

same as apply

References apply_scaling_to_HU().

Referenced by apply_scaling_to_HU(), and virtual_apply().

◆ set_slope()

template<typename TargetT>
void stir::HUToMuImageProcessor< TargetT >::set_slope ( float a1,
float a2,
float b1,
float b2,
float breakPoint )

set the slope without JSON file

References set_slope().

Referenced by set_slope().

◆ 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.

References set_defaults(), and stir::ParsingObject::set_defaults().

Referenced by HUToMuImageProcessor(), and set_defaults().

◆ initialise_keymap()

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

Initialise all keywords.

Reimplemented from stir::ParsingObject.

References initialise_keymap(), and stir::ParsingObject::initialise_keymap().

Referenced by initialise_keymap().

◆ 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.

References post_processing(), and stir::ParsingObject::post_processing().

Referenced by post_processing().

◆ 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 virtual_set_up().

Referenced by virtual_set_up().

◆ virtual_apply()

template<typename TargetT>
void stir::HUToMuImageProcessor< TargetT >::virtual_apply ( TargetT & data,
const TargetT & in_data ) const
overrideprotectedvirtual

Performs actual operation (virtual_set_up is called before this function).

Implements stir::DataProcessor< TargetT >.

References apply_scaling_to_HU(), and virtual_apply().

Referenced by virtual_apply().


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