33 unsigned int images = headers.size();
35 unsigned int unweighted_images = 0;
36 unsigned int weighted_images = 0;
38 mitk::DiffusionHeaderDICOMFileReader::DICOMHeaderListType::const_iterator c_iter = headers.begin();
39 while( c_iter != headers.end() )
42 if( h.
baseline ) unweighted_images++;
43 if( h.
b_value > 0 ) weighted_images++;
48 MITK_INFO <<
" :: Analyzed volumes " << images <<
"\n"
49 <<
" :: \t"<< unweighted_images <<
" b = 0" <<
"\n"
50 <<
" :: \t"<< weighted_images <<
" b > 0";
66 unsigned int numberOfOutputs = this->GetNumberOfOutputs();
69 for(
unsigned int o = 0; o < numberOfOutputs; ++o)
71 success &= this->LoadSingleOutputImage( this->m_OutputHeaderContainer.at(o),
72 this->InternalGetOutput(o), this->m_IsMosaicData.at(o) );
89 int numberOfFramesPerDWImage = frames.size() / numberOfDWImages;
91 assert(
int(
double((
double) frames.size() / (double) numberOfDWImages)) == numberOfFramesPerDWImage );
92 for(
int idx = 0; idx < numberOfDWImages; idx++ )
94 std::vector< std::string > FileNamesPerVolume;
96 auto timeStepStart = frames.begin() + idx * numberOfFramesPerDWImage;
97 auto timeStepEnd = frames.begin() + (idx+1) * numberOfFramesPerDWImage;
98 for (
auto frameIter = timeStepStart;
99 frameIter != timeStepEnd;
102 FileNamesPerVolume.push_back( (*frameIter)->Filename );
105 filenames.push_back( FileNamesPerVolume );
116 double max_bvalue = 0;
117 for(
int idx = 0; idx < numberOfDWImages; idx++ )
121 if( max_bvalue < header.
b_value )
126 for(
int idx = 0; idx < numberOfDWImages; idx++ )
132 grad *= sqrt( header.
b_value / max_bvalue );
134 directions->push_back( grad );
141 if( is_mosaic && this->m_ResolveMosaic )
148 mosaic_reader->RetrieveMosaicInformation( filenames.at(0).at(0) );
172 this->SetGroup3DandT(
true);
174 Superclass::AnalyzeInputFiles();
177 size_t number_of_outputs = this->GetNumberOfOutputs();
179 if(number_of_outputs == 0)
181 MITK_ERROR <<
"Failed to parse input, retrieved 0 outputs from SeriesGDCMReader ";
184 MITK_INFO(
"diffusion.dicomreader") <<
"Retrieved " << number_of_outputs <<
" outputs.";
185 std::vector< bool > valid_input_list;
187 for(
unsigned int outputidx = 0; outputidx < this->GetNumberOfOutputs(); outputidx++ )
194 inputFilename.push_back( frame_0->Filename );
199 bool isMosaic =
false;
200 gdcm::Scanner gdcmScanner;
202 gdcm::Tag t_vendor(0x008, 0x0070);
203 gdcm::Tag t_imagetype(0x008, 0x008);
206 gdcmScanner.AddTag( t_vendor );
208 gdcmScanner.AddTag( t_imagetype );
209 if( gdcmScanner.Scan( inputFilename ) )
213 const char* ch_vendor = gdcmScanner.GetValue( frame_0->Filename.c_str(), t_vendor );
214 const char* ch_image_type = gdcmScanner.GetValue( frame_0->Filename.c_str(), t_imagetype );
216 if( ch_vendor == NULL || ch_image_type == NULL )
218 MITK_WARN <<
"Unable to retrieve vendor/image information from " << frame_0->Filename.c_str() <<
"\n" <<
219 "Output " << outputidx+1 <<
" is not valid, skipping analysis.";
220 valid_input_list.push_back(
false);
225 std::string vendor = std::string( ch_vendor );
226 std::string image_type = std::string( ch_image_type );
227 MITK_INFO(
"diffusion.dicomreader") <<
"Output " << outputidx+1 <<
" Got vendor: " << vendor <<
" image type " << image_type;
230 if( vendor.find(
"SIEMENS") != std::string::npos )
233 if( image_type.find(
"MOSAIC") != std::string::npos )
244 else if( vendor.find(
"GE") != std::string::npos )
248 else if( vendor.find(
"Philips") != std::string::npos )
257 if( headerReader.IsNull() )
259 MITK_ERROR <<
"No header reader for given vendor. ";
260 valid_input_list.push_back(
false);
267 valid_input_list.push_back(
false);
272 bool canread =
false;
278 for(
int idx = 0; idx < numberOfTimesteps; idx++ )
280 int access_idx = idx * framesPerTimestep;
282 canread = headerReader->ReadDiffusionHeader( frame->Filename );
290 m_IsMosaicData.push_back(isMosaic);
291 m_OutputHeaderContainer.push_back( retrievedHeader );
292 m_OutputReaderContainer.push_back( headerReader );
293 valid_input_list.push_back(
true);
298 std::vector< DICOMImageBlockDescriptor > valid_outputs;
299 for (
unsigned int outputidx = 0; outputidx < this->GetNumberOfOutputs(); ++outputidx )
301 if( valid_input_list.at(outputidx) )
303 valid_outputs.push_back( this->InternalGetOutput( outputidx ) );
308 this->ClearOutputs();
309 this->SetNumberOfOutputs( valid_outputs.size() );
312 for (
unsigned int outputidx = 0; valid_outputs.size(); ++outputidx )
314 this->SetOutput( outputidx, valid_outputs.at( outputidx ) );
319 for(
unsigned int outputidx = 0; outputidx < this->GetNumberOfOutputs(); outputidx++ )
322 MITK_INFO(
"diffusion.dicomreader") <<
"---- DICOM Analysis Report ---- :: Output " << outputidx+1 <<
" of " << this->GetNumberOfOutputs();
327 catch(
const std::exception& se)
332 MITK_INFO(
"diffusion.dicomreader") <<
"===========================================";
section MAP_FRAME_Mapper_Settings Mapper settings For the mapping of corrected you have several settings but high interpolation errors for gray value images Right choice for label images or masks li Details of the frame selection In this tab you can specify the frames of the currently selected image that should be corrected As default all frames of an image will be corrected If you only select specific frames
DiffusionDICOMFileReader()
const DICOMImageFrameList & GetImageFrameList() const
List of frames that constitute the mitk::Image (DICOMImageFrames)
static const std::string REFERENCEBVALUEPROPERTYNAME
itk::SmartPointer< Self > Pointer
The MosaicDescriptor struct is a help struct holding the necessary information for loading a mosaic D...
int GetIntProperty(const std::string &key, int defaultValue) const
Convenience function around GetProperty()
virtual ~DiffusionDICOMFileReader()
Helper class for mitk::Images containing diffusion weighted data.
bool LoadSingleOutputImage(DiffusionHeaderDICOMFileReader::DICOMHeaderListType, DICOMImageBlockDescriptor &, bool)
static void PerformHeaderAnalysis(mitk::DiffusionHeaderDICOMFileReader::DICOMHeaderListType headers)
void SetMitkImage(Image::Pointer image)
The 3D mitk::Image that is loaded from the DICOM files of a DICOMImageFrameList.
void InitializeImage()
Make certain the owned image is up to date with all necessary properties.
std::vector< StringContainer > VolumeFileNamesContainer
std::string GetOutputName(const VolumeFileNamesContainer &filenames)
std::vector< DICOMImageFrameInfo::Pointer > DICOMImageFrameList
Output descriptor for DICOMFileReader.
GradientDirectionsProperty::GradientDirectionType GradientDirectionType
itk::VectorImage< PixelType, VecImageDimension >::Pointer LoadMosaicToVector(const VolumeFileNamesContainer &filenames, const MosaicDescriptor &mosaicInfo)
std::vector< std::string > StringList
Image::Pointer GetMitkImage() const
the 3D mitk::Image that is loaded from the DICOM files of a DICOMImageFrameList
void CastToMitkImage(const itk::SmartPointer< ItkOutputImageType > &itkimage, itk::SmartPointer< mitk::Image > &mitkoutputimage)
Cast an itk::Image (with a specific type) to an mitk::Image.
virtual bool CanHandleFile(const std::string &filename) override
Indicate whether this reader can handle given file.
virtual bool LoadImages() override
Load via multiple calls to itk::ImageSeriesReader.
static const std::string GRADIENTCONTAINERPROPERTYNAME
itk::VectorImage< PixelType, VecImageDimension >::Pointer LoadToVector(const VolumeFileNamesContainer &filenames)
section MAP_FRAME_Mapper_Settings Mapper settings For the mapping of corrected images
virtual void AnalyzeInputFiles() override
Runs the sorting / splitting process described in Loading strategy. Method required by DICOMFileReade...
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.