21 #include "itksys/SystemTools.hxx" 35 std::string name = fileName;
36 m_FileExtension = itksys::SystemTools::GetFilenameLastExtension( fileName );
47 throw std::logic_error(
"The specified file type is not supported, standard file type is .nrrd!");
49 int pos = name.find_last_of(
".");
50 name.insert(pos,
"_DistanceImage");
53 name.insert(pos,
"_AmplitudeImage");
56 name.insert(pos,
"_IntensityImage");
68 assert(distanceImageInput);
70 assert(amplitudeImageInput);
72 assert(intensityImageInput);
74 ImageReadAccessor distAcc(distanceImageInput, distanceImageInput->GetSliceData(0,0,0));
75 ImageReadAccessor amplAcc(amplitudeImageInput, amplitudeImageInput->GetSliceData(0,0,0));
76 ImageReadAccessor intenAcc(intensityImageInput, intensityImageInput->GetSliceData(0,0,0));
78 float* distanceFloatData = (
float*) distAcc.
GetData();
79 float* amplitudeFloatData = (
float*) amplAcc.GetData();
80 float* intensityFloatData = (
float*) intenAcc.GetData();
83 m_ToFImageWriter->Add(distanceFloatData,amplitudeFloatData,intensityFloatData);
87 this->SetNthOutput(0,distanceImageInput);
88 this->SetNthOutput(1,amplitudeImageInput);
89 this->SetNthOutput(2,intensityImageInput);
96 throw std::logic_error(
"ToFImageWriter is unitialized, set filename first!");
126 if ((input ==
nullptr) && (idx == this->GetNumberOfInputs() - 1))
128 this->SetNumberOfIndexedInputs(this->GetNumberOfInputs() - 1);
130 else if(idx == 0 || idx == 1 || idx == 2)
132 this->ProcessObject::SetNthInput(idx, const_cast<InputImageType*>(input));
149 if (this->GetNumberOfInputs() < 1)
151 return static_cast< mitk::Image*
>(this->ProcessObject::GetInput(idx));
156 this->SetNumberOfIndexedOutputs(this->GetNumberOfIndexedInputs());
157 for (
unsigned int idx = 0; idx < this->GetNumberOfOutputs(); ++idx)
160 DataObjectPointer newOutput = this->
MakeOutput(idx);
161 this->SetNthOutput(idx, newOutput);
void SetImageType(ToFImageWriter::ToFImageType tofImageType)
Set image type for recording.
ToFImageRecorderFilter()
standard constructor
itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
ToFImageWriter::Pointer m_ToFImageWriter
image writer used for streaming input data to file
void StartRecording()
start recording of data
std::string m_FileExtension
bool m_RecordingStarted
flag indicating if filter is currently recording
void CreateOutputsForAllInputs()
Create an output for each input.
void StopRecording()
stop recording of data
void SetInput(const InputImageType *input) override
sets the input of this filter
unsigned int GetDimension() const
Get dimension of the image.
void GenerateData() override
method generating the output of this filter. Called in the updated process of the pipeline...
void SetFileName(std::string fileName)
Set file name for writing image files This filename will be appended by "_DistanceImage", "_AmplitudeImage", or "_IntensityImage" for the single images.
Image class for storing images.
~ToFImageRecorderFilter() override
standard destructor
void SetToFImageWriter(ToFImageWriter::Pointer tofImageWriter)
Sets a pointer to the ToFImageWriter internally used.
ToFImageWriter::Pointer GetToFImageWriter()
Returns a pointer to the ToFImageWriter internally used.
OutputType * GetOutput()
Get the output data of this image source object.
ImageReadAccessor class to get locked read access for a particular image part.
Image * GetInput()
returns the input of this filter
const void * GetData() const
Gives const access to the data.