Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDICOMFilesHelper.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkDICOMFilesHelper.h"
18 
19 #include <itkGDCMImageIO.h>
20 #include <itksys/SystemTools.hxx>
21 #include <gdcmDirectory.h>
22 
24 {
25  DICOMFilePathList result;
26 
27  if (!filePath.empty())
28  {
29  std::string dir = itksys::SystemTools::GetFilenamePath(filePath);
30 
31  gdcm::Directory directoryLister;
32  directoryLister.Load(dir.c_str(), false); // non-recursive
33  result = FilterForDICOMFiles(directoryLister.GetFilenames());
34  }
35 
36  return result;
37 };
38 
40 {
42 
44  for (auto aFile : fileList)
45  {
46  if (io->CanReadFile(aFile.c_str()))
47  {
48  result.push_back(aFile);
49  }
50  }
51 
52  return result;
53 };
itk::SmartPointer< Self > Pointer
DICOMFilePathList GetDICOMFilesInSameDirectory(const std::string &filePath)
DICOMFilePathList FilterForDICOMFiles(const DICOMFilePathList &fileList)
std::vector< std::string > DICOMFilePathList
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.