17 #ifndef __mitkDicomDiffusionImageReader_cpp
18 #define __mitkDicomDiffusionImageReader_cpp
22 #include "itkImageSeriesReader.h"
28 template <
class TPixelType, const
int TDimension>
32 Superclass::PrintSelf(os, indent);
36 template <
class TPixelType, const
int TDimension>
41 typedef itk::ImageSeriesReader<InputImageType> ReaderType;
44 if (m_Headers.size() > 0)
51 reader->SetFileNames (m_Headers[0]->m_DicomFilenames);
52 reader->UpdateOutputInformation();
54 output->SetSpacing( reader->GetOutput()->GetSpacing() );
55 output->SetOrigin( reader->GetOutput()->GetOrigin() );
56 output->SetDirection( reader->GetOutput()->GetDirection() );
57 output->SetLargestPossibleRegion( reader->GetOutput()->GetLargestPossibleRegion() );
58 output->SetVectorLength( m_Headers.size() );
60 catch (itk::ExceptionObject &e)
67 itkExceptionMacro(<<
"At least one filename is required." );
72 template <
class TPixelType, const
int TDimension>
78 out->SetRequestedRegion( out->GetLargestPossibleRegion() );
82 template <
class TPixelType, const
int TDimension>
86 typedef itk::ImageSeriesReader<InputImageType> ReaderType;
90 typedef typename OutputImageType::RegionType RegionType;
91 RegionType requestedRegion = output->GetRequestedRegion();
94 SizeType validSize = requestedRegion.GetSize();
96 int numberOfVolumes =
static_cast<int>(m_Headers.size());
99 output->SetBufferedRegion( requestedRegion );
102 itk::ProgressReporter progress(
this, 0,
106 itk::ImageRegionIterator<OutputImageType> ot (output, requestedRegion );
110 for (
int i = 0; i < numberOfVolumes; i ++)
113 MITK_INFO <<
"Loading volume " << i+1 <<
"/" << numberOfVolumes;
115 reader->SetFileNames(m_Headers[i]->m_DicomFilenames);
116 reader->UpdateLargestPossibleRegion();
118 if (reader->GetOutput()->GetRequestedRegion().GetSize() != validSize)
120 itkExceptionMacro(<<
"Size mismatch!");
123 itk::ImageRegionConstIterator<InputImageType> it (reader->GetOutput(),
124 reader->GetOutput()->GetLargestPossibleRegion());
126 while (!it.IsAtEnd())
129 vec.SetElement(i, it.Get());
135 progress.CompletedPixel();
itk::SmartPointer< Self > Pointer
virtual void GenerateData()
virtual void GenerateOutputInformation(void)
DataCollection - Class to facilitate loading/accessing structured data.
itk::VectorImage< TPixelType, TDimension > OutputImageType
OutputImageType::SizeType SizeType
virtual void EnlargeOutputRequestedRegion(itk::DataObject *output)
void PrintSelf(std::ostream &os, itk::Indent indent) const
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.