ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itk::ScancoHeaderIO Class Reference

#include <itkScancoHeaderIO.h>

Detailed Description

Read Scanco image headers.

Definition at line 34 of file itkScancoHeaderIO.h.

+ Inheritance diagram for itk::ScancoHeaderIO:
+ Collaboration diagram for itk::ScancoHeaderIO:

Public Types

enum class  ScancoFileVersions {
  UNRECOGNIZED = 0 ,
  CTHEADER = 1 ,
  AIM_020 = 2 ,
  AIM_030 = 3
}
 

Public Member Functions

unsigned long ReadHeader (const std::string filename="")
 
virtual unsigned long ReadHeader (std::ifstream &infile)
 
 ScancoHeaderIO (itkScancoHeaderData *headerData, std::string filename="")
 
void SetFilename (const std::string filename)
 
void SetHeaderData (itkScancoHeaderData *headerData)
 
virtual unsigned long WriteHeader (std::ofstream &outfile, unsigned long imageSize)
 
unsigned long WriteHeader (unsigned long imageSize, std::string filename="")
 
virtual ~ScancoHeaderIO ()=default
 

Protected Attributes

std::string m_FileName = ""
 
itkScancoHeaderData * m_HeaderData { nullptr }
 

Member Enumeration Documentation

◆ ScancoFileVersions

Enumerator
UNRECOGNIZED 
CTHEADER 
AIM_020 
AIM_030 

Definition at line 37 of file itkScancoHeaderIO.h.

Constructor & Destructor Documentation

◆ ScancoHeaderIO()

itk::ScancoHeaderIO::ScancoHeaderIO ( itkScancoHeaderData * headerData,
std::string filename = "" )

Constructor that initializes the header data pointer. If the pointer is null, the object will fail to be created and will throw an exception.

Parameters
headerDataPointer to the location to store the header data
Note
m_RawHeader will be overwritten on read and/or write
Parameters
filenameoptional filename to read the header from or write to. If no filename is provided, it can be specified later using ReadHeader or WriteHeader
See also
ReadHeader(std::string filename) and WriteHeader(std::string filename)
Exceptions
std::runtime_errorif headerData is null.

◆ ~ScancoHeaderIO()

virtual itk::ScancoHeaderIO::~ScancoHeaderIO ( )
virtualdefault

Destructor

Member Function Documentation

◆ ReadHeader() [1/2]

unsigned long itk::ScancoHeaderIO::ReadHeader ( const std::string filename = "")

Read the header from a file. If the filename is empty, it will use the m_FileName member variable. If m_FileName is also empty, it will throw an exception.

Parameters
filenameThe name of the file to read the header from. [optional]
Note
If the filename is provided, it will overwrite the m_FileName member variable.
Exceptions
std::runtime_errorif no filename is provided and m_FileName is empty.
Returns
number of bytes read from the file.

◆ ReadHeader() [2/2]

virtual unsigned long itk::ScancoHeaderIO::ReadHeader ( std::ifstream & infile)
virtual

Read the header from an infile.

Parameters
infileThe input file stream to read the header from.
Exceptions
std::runtime_errorif the file cannot be opened or read.
Note
Subclasses should implement this method to read the header in the specific format they support.
Returns
number of bytes read from the file.

Reimplemented in itk::AIMHeaderIO, and itk::ISQHeaderIO.

◆ SetFilename()

void itk::ScancoHeaderIO::SetFilename ( const std::string filename)

◆ SetHeaderData()

void itk::ScancoHeaderIO::SetHeaderData ( itkScancoHeaderData * headerData)

◆ WriteHeader() [1/2]

virtual unsigned long itk::ScancoHeaderIO::WriteHeader ( std::ofstream & outfile,
unsigned long imageSize )
virtual

Write the header to an open file stream.

Parameters
outfilePointer to an open std::ofstream where the header will be written.
imageSizesize of the image that will be written after the header, in bytes
Exceptions
std::runtime_errorif headerData is null.
Note
sublcasses should implement this method to write the header in the specific format they support.
Returns
number of bytes written to the file.

Reimplemented in itk::AIMHeaderIO, and itk::ISQHeaderIO.

◆ WriteHeader() [2/2]

unsigned long itk::ScancoHeaderIO::WriteHeader ( unsigned long imageSize,
std::string filename = "" )

Write the header to a file. If the filename is empty, it will use the m_FileName member variable. If m_FileName is also empty, it will throw an exception.

Parameters
filenameThe name of the file to write the header to [optional]
imageSizesize of the image that will be written after the header, in bytes
Note
If the filename is provided, it will overwrite the m_FileName member variable.
Exceptions
std::runtime_errorif no filename is provided and m_FileName is empty.
Returns
number of bytes written to the file.

Member Data Documentation

◆ m_FileName

std::string itk::ScancoHeaderIO::m_FileName = ""
protected

Definition at line 114 of file itkScancoHeaderIO.h.

◆ m_HeaderData

itkScancoHeaderData* itk::ScancoHeaderIO::m_HeaderData { nullptr }
protected

Definition at line 113 of file itkScancoHeaderIO.h.


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