17 #ifndef mitkDICOMFileReaderTestHelper_h
18 #define mitkDICOMFileReaderTestHelper_h
42 for (
int a = 1; a < argc; ++a)
44 inputFiles.push_back( argv[a] );
62 MITK_TEST_CONDITION( inputFilesReturned.size() == inputFiles.size(),
"Input file list is received")
76 for (
unsigned int o = 0; o < numberOfOutputs; ++o)
81 for(
auto iter = outputFiles.cbegin();
82 iter != outputFiles.cend();
86 auto inputPositionOfCurrentOutput = std::find( inputFiles.cbegin(), inputFiles.cend(), (*iter)->Filename );
87 if (inputPositionOfCurrentOutput != inputFiles.cend())
90 auto outputPositionOfCurrentOutput = std::find( allSortedInputsFiles.cbegin(), allSortedInputsFiles.cend(), (*iter)->Filename );
91 if (outputPositionOfCurrentOutput == allSortedInputsFiles.cend())
94 allSortedInputsFiles.push_back( *inputPositionOfCurrentOutput );
99 MITK_TEST_CONDITION_REQUIRED(
false,
"File '" << (*iter)->Filename <<
"' appears in TWO outputs. Readers are expected to use each frame only once." )
110 MITK_TEST_CONDITION( allSortedInputsFiles.size() == inputFiles.size(),
"Output list size (" << allSortedInputsFiles.size() <<
") equals input list size (" << inputFiles.size() <<
")" )
117 catch( std::invalid_argument& )
125 const std::unordered_map<std::string, std::string>& expectedProperties )
134 for (
unsigned int o = 0; o < numberOfOutputs; ++o)
141 for (
auto iter = requestedTags.cbegin(); iter != requestedTags.cend(); ++iter)
143 mitk::BaseProperty*
property = mitkImage->GetProperty( iter->second.c_str() ).GetPointer();
145 "Requested Tag is available as Property in Image" );
148 MITK_INFO << iter->first.ToStr() <<
" / " <<
property->GetNameOfClass();
149 auto expectfinding = expectedProperties.find(iter->second);
151 if (expectfinding != expectedProperties.end())
153 MITK_TEST_CONDITION(std::string(property->GetNameOfClass()) == expectfinding->second,
"Property type is as expected");
159 MITK_DEBUG <<
"-------------------------------------------";
160 MITK_DEBUG <<
"Output " << o <<
" at " << (
void*) mitkImage.GetPointer();
161 MITK_DEBUG <<
" Number of files: " << outputFiles.size();
162 MITK_DEBUG <<
" Dimensions: " << mitkImage->GetDimension(0) <<
" " << mitkImage->GetDimension(1) <<
" " << mitkImage->GetDimension(2);
static void TestMitkImagesAreLoaded(DICOMFileReader *reader, const DICOMFileReader::AdditionalTagsMapType &requestedTags, const std::unordered_map< std::string, std::string > &expectedProperties)
const DICOMImageFrameList & GetImageFrameList() const
List of frames that constitute the mitk::Image (DICOMImageFrames)
const DICOMImageBlockDescriptor & GetOutput(unsigned int index) const
Individual outputs, only meaningful after calling AnalyzeInputFiles().
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
static mitk::BaseProperty::Pointer DummyTagToPropertyFunctor(const mitk::StringLookupTable &)
static StringList & GetInputFilenames()
DataCollection - Class to facilitate loading/accessing structured data.
virtual bool LoadImages()=0
void PrintOutputs(std::ostream &os, bool filenameDetails=false) const
Print output description to given stream, for human reader.
itk::SmartPointer< Self > Pointer
void SetInputFiles(const StringList &filenames)
This input files.
virtual void AnalyzeInputFiles()=0
Analyze input files.
Abstract base class for properties.
#define MITK_TEST_CONDITION(COND, MSG)
std::vector< DICOMImageFrameInfo::Pointer > DICOMImageFrameList
DICOMImageBlockDescriptor::AdditionalTagsMapType AdditionalTagsMapType
Output descriptor for DICOMFileReader.
static void TestOutputsContainInputs(DICOMFileReader *reader)
static void SetTestInputFilenames(const StringList &filenames)
std::vector< std::string > StringList
Image::Pointer GetMitkImage() const
the 3D mitk::Image that is loaded from the DICOM files of a DICOMImageFrameList
static void SetTestInputFilenames(int argc, char *argv[])
static void TestInputFilenames(DICOMFileReader *reader)
Interface for DICOM readers that produce mitk::Images.
unsigned int GetNumberOfOutputs() const
Number of outputs, only meaningful after calling AnalyzeInputFiles()
const StringList & GetInputFiles() const
This input files.