|
STIR 6.4.0
|
Implementation of OutputFileFormat paradigm using the ITK library for writing. More...
#include "stir/IO/ITKOutputFileFormat.h"

Public Member Functions | |
| ITKOutputFileFormat (const NumericType &=NumericType::FLOAT, const ByteOrder &=ByteOrder::native) | |
| ByteOrder | set_byte_order (const ByteOrder &, const bool warn=false) override |
| set byte order used for output | |
Public Member Functions inherited from stir::RegisteredParsingObject< ITKOutputFileFormat, OutputFileFormat< DiscretisedDensity< 3, float > >, OutputFileFormat< DiscretisedDensity< 3, float > > > | |
| 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. | |
| 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::OutputFileFormat< DiscretisedDensity< 3, float > > | |
| OutputFileFormat (const NumericType &=NumericType::FLOAT, const ByteOrder &=ByteOrder::native) | |
| Succeeded | write_to_file (std::string &filename, const DiscretisedDensity< 3, float > &data) const |
| Write a single image to file. | |
| Succeeded | write_to_file (const std::string &filename, const DiscretisedDensity< 3, float > &density) const |
| write a single image to file | |
| NumericType | get_type_of_numbers () const |
| get type used for outputting numbers | |
| ByteOrder | get_byte_order () |
| get byte order used for output | |
| float | get_scale_to_write_data () const |
| get scale to write the data | |
| virtual NumericType | set_type_of_numbers (const NumericType &, const bool warn=false) |
| set type used for outputting numbers | |
| virtual void | set_byte_order_and_type_of_numbers (ByteOrder &, NumericType &, const bool warn=false) |
| set byte order and data type used for output | |
| virtual float | set_scale_to_write_data (const float new_scale_to_write_data, const bool warn=false) |
| set scale outputting numbers | |
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 Attributes | |
| std::string | default_extension |
| default extension to use if none present | |
Static Public Attributes | |
| static const char *const | registered_name = "ITK" |
| Name which will be used when parsing an OutputFileFormat object. | |
Protected Member Functions | |
| Succeeded | actual_write_to_file (std::string &output_filename, const DiscretisedDensity< 3, float > &density) const override |
| virtual function called by write_to_file() | |
| void | set_defaults () override |
| Set defaults before parsing. | |
| void | initialise_keymap () override |
| Initialise all keywords. | |
| bool | post_processing () override |
| This will be called at the end of the parsing. | |
Protected Member Functions inherited from stir::OutputFileFormat< DiscretisedDensity< 3, float > > | |
| void | set_defaults () override |
| sets value for output data type | |
| void | initialise_keymap () override |
| sets keys for output data type for parsing | |
| bool | post_processing () override |
| Checks if parameters have sensible values after parsing. | |
| void | set_key_values () override |
| overloaded member for ParsingObject::set_key_values() | |
Additional Inherited Members | |
Static Public Member Functions inherited from stir::RegisteredParsingObject< ITKOutputFileFormat, OutputFileFormat< DiscretisedDensity< 3, float > >, OutputFileFormat< DiscretisedDensity< 3, float > > > | |
| static OutputFileFormat< DiscretisedDensity< 3, float > > * | read_from_stream (std::istream *) |
| Construct a new object (of type Derived) by parsing the istream. | |
| static OutputFileFormat< DiscretisedDensity< 3, float > > * | read_from_stream (std::istream *) |
| Construct a new object (of type Derived) by parsing the istream. | |
Static Public Member Functions inherited from stir::OutputFileFormat< DiscretisedDensity< 3, float > > | |
| static shared_ptr< OutputFileFormat< DiscretisedDensity< 3, float > > > | default_sptr () |
| A function to return a default output file format. | |
Static Public Member Functions inherited from stir::RegisteredObject< OutputFileFormat< DiscretisedDensity< 3, float > > > | |
| static OutputFileFormat< DiscretisedDensity< 3, float > > * | read_registered_object (std::istream *in, const std::string ®istered_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 OutputFileFormat< DiscretisedDensity< 3, float > > * | 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< OutputFileFormat< DiscretisedDensity< 3, float > > > | |
| typedef OutputFileFormat< DiscretisedDensity< 3, float > > *(* | 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< OutputFileFormat< DiscretisedDensity< 3, float > > > | |
| static RegistryType & | registry () |
| Static function returning the registry. | |
Protected Attributes inherited from stir::OutputFileFormat< DiscretisedDensity< 3, float > > | |
| NumericType | type_of_numbers |
| type used for outputting numbers | |
| ByteOrder | file_byte_order |
| byte order used for output | |
| float | scale_to_write_data |
| scale to write the data | |
| KeyParser | parser |
Implementation of OutputFileFormat paradigm using the ITK library for writing.
ITK (http://www.itk.org) has its own registry of file formats, so the current class provides an interface to that code. We translate the STIR data to ITK and then use its writing code. This translation is currently incomplete however.
ITK chooses the file format based on the extension of the filename. This is currently different from STIR. Therefore, this class can be used to write Nifti (.nii), Teem (.nhdr), MetaIO (.mhdr), etc.
In this class, we provide a default extension that will be appended if a filename without extension is used.
ITK Output File Format Parameters:= default extension:= .nhdr ; current default value End ITK Output File Format Parameters:=
|
overridevirtual |
set byte order used for output
Returns type actually used. Calls warning() with some text if the requested type is not supported.
Default implementation accepts any byte order.
Reimplemented from stir::OutputFileFormat< DiscretisedDensity< 3, float > >.
References stir::OutputFileFormat< DiscretisedDensity< 3, float > >::file_byte_order, and set_byte_order().
Referenced by set_byte_order().
|
overrideprotectedvirtual |
virtual function called by write_to_file()
This function has to be overloaded by the derived class.
The reason we do not simply make write_to_file() virtual is that we have 2 versions of write_to_file. C++ rules are such that overloading the virtual function in a derived class means that the other version gets hidden. Having the non-virtual write_to_file() call the virtual actual_write_to_file() solves this problem.
Implements stir::OutputFileFormat< DiscretisedDensity< 3, float > >.
References actual_write_to_file(), stir::add_extension(), stir::Array< num_dimensions, elemT >::begin_all_const(), default_extension, stir::OutputFileFormat< DiscretisedDensity< 3, float > >::file_byte_order, stir::DiscretisedDensity< num_dimensions, elemT >::get_LPS_coordinates_for_indices(), stir::Array< num_dimensions, elemT >::get_regular_range(), stir::VoxelsOnCartesianGrid< elemT >::get_voxel_size(), stir::VoxelsOnCartesianGrid< elemT >::get_x_size(), stir::norm(), stir::OutputFileFormat< DiscretisedDensity< 3, float > >::scale_to_write_data, stir::OutputFileFormat< DiscretisedDensity< 3, float > >::type_of_numbers, and stir::warning().
Referenced by actual_write_to_file().
|
overrideprotectedvirtual |
Set defaults before parsing.
Reimplemented from stir::ParsingObject.
References default_extension, set_defaults(), and stir::ParsingObject::set_defaults().
Referenced by set_defaults().
|
overrideprotectedvirtual |
Initialise all keywords.
Reimplemented from stir::ParsingObject.
References default_extension, initialise_keymap(), and stir::ParsingObject::initialise_keymap().
Referenced by initialise_keymap().
|
overrideprotectedvirtual |
This will be called at the end of the parsing.
Reimplemented from stir::ParsingObject.
References post_processing(), and stir::ParsingObject::post_processing().
Referenced by post_processing().
| std::string stir::ITKOutputFileFormat::default_extension |
default extension to use if none present
This will determine the file format used if passing a filename without extension.
Referenced by actual_write_to_file(), initialise_keymap(), stir::TestBSplineTransformation::run_transformation(), and set_defaults().