Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkCollectionWriter.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 #pragma warning (disable : 4996)
17 
18 #include "mitkCollectionWriter.h"
19 
20 #include <mitkIOUtil.h>
21 #include <mitkFiberBundle.h>
23 
24 #include "mitkImageCast.h"
25 #include "mitkTensorImage.h"
26 #include "itkNrrdImageIO.h"
27 #include "itkImageFileWriter.h"
28 #include "mitkCoreObjectFactory.h"
29 
30 
31 #include <iostream>
32 #include <fstream>
33 
34 #include <QDir>
35 
36 //XML StateMachine Tags
37 // Objects
38 const std::string COLLECTION = "col";
39 const std::string SUBCOLLECTION = "subcol";
40 const std::string DATA = "data";
41 const std::string ITEM = "item";
42 // Properties
43 const std::string NAME = "name";
44 const std::string ID = "id";
45 const std::string FILEPATH = "filepath";
46 const std::string LINK = "link";
47 
48 
49 static std::string GetName(std::string fileName,std::string suffix, bool longName = false)
50 {
51  fileName = QFileInfo(QString::fromStdString(fileName)).fileName().toStdString();
52  if (longName)
53  return fileName.substr(0,fileName.length() -suffix.length()-11); // 10 = date length
54  else
55  return fileName.substr(0,fileName.length() -suffix.length()-9); // 8 = date length
56 }
57 
58 static std::string GetDate(std::string fileName,std::string suffix, bool longName = false)
59 {
60  fileName = QFileInfo(QString::fromStdString(fileName)).fileName().toStdString();
61  if (longName)
62  fileName = fileName.substr(fileName.length() - suffix.length()-10,10); // 8 = date length
63  else
64  fileName = fileName.substr(fileName.length() - suffix.length()-8,8); // 8 = date length
65  if (!longName)
66  {
67  fileName.insert(6,"-");
68  fileName.insert(4,"-");
69  }
70  return fileName;
71 }
72 
73 
74 
75 
76 bool mitk::CollectionWriter::ExportCollectionToFolder(DataCollection *dataCollection, std::string xmlFile, std::vector<std::string> filter)
77 {
78  // Quick and Dirty: Assumes three level DataCollection
79  QDir fileName = QFileInfo(xmlFile.c_str()).absoluteDir();
80  std::string outputFolder = fileName.path().toStdString() + QDir::separator().toLatin1();
81  QDir baseFolder(outputFolder.c_str());
82  baseFolder.mkpath(outputFolder.c_str());
83 
84  std::ofstream xmlFileStream;
85  xmlFileStream.open (xmlFile.c_str());
86  xmlFileStream << "<!-- MITK - DataCollection - File Version 1.0 --> \n";
87  xmlFileStream << "<" << COLLECTION << " " << NAME << "=\"" << dataCollection->GetName() << "\" >\n";
88  unsigned int subColId = 0;
89 
90  unsigned int dataId = 0;
91 
92  QDir dir(QString::fromStdString(outputFolder));
93  for (size_t i = 0 ; i < dataCollection->Size(); ++i)
94  {
95  // Write Subcollection tag
96  xmlFileStream << " <" << SUBCOLLECTION << " " << NAME << "=\"" << dataCollection->IndexToName(i) << "\" " << FILEPATH << "=\"" << dataCollection->GetDataFilePath(i) << "\" id=\"Col" << subColId << "\" >\n";
97  // Create Sub-Folder
98  dir.mkpath(QString::fromStdString(dataCollection->IndexToName(i)));
99 
100  // Herein create data folders
101  DataCollection* subCollections = dynamic_cast<DataCollection*> (dataCollection->GetData(i).GetPointer());
102  if (subCollections == NULL)
103  {
104  MITK_ERROR<< "mitk::CollectionWriter::SaveCollectionToFolder: Container is illformed. Aborting";
105  return false;
106  }
107 
108  for (size_t d = 0; d < subCollections->Size(); d++ )
109  {
110  // Create Sub Paths
111  QString subPath = QString::fromStdString(dataCollection->IndexToName(i))+"/"+QString::fromStdString(subCollections->IndexToName(d));
112  dir.mkpath(subPath);
113  xmlFileStream << " <" << DATA << " " << NAME << "=\"" << subCollections->IndexToName(d) << "\" " << FILEPATH << "=\"" << subCollections->GetDataFilePath(d) << "\" id=\"Data" << dataId << "\" >\n";
114 
115  DataCollection* itemCollections = dynamic_cast<DataCollection*> (subCollections->GetData(d).GetPointer());
116  if (itemCollections == NULL)
117  {
118  MITK_ERROR<< "mitk::CollectionWriter::SaveCollectionToFolder: Container is illformed. Aborting";
119  return false;
120  }
121 
122  for (size_t s = 0; s < itemCollections->Size(); s++)
123  {
124  if (filter.size() > 0)
125  {
126  bool isSelected = false;
127  for (size_t f = 0; f < filter.size(); f++)
128  {
129  if (filter.at(f) == itemCollections->IndexToName(s) )
130  {
131  isSelected = true;
132  break;
133  }
134  }
135  if (isSelected == false)
136  continue;
137  }
138  Image* image = dynamic_cast<Image*> (itemCollections->GetData(s).GetPointer());
139  QString fileName = dir.path() + dir.separator() + subPath + dir.separator() + QString::fromStdString(dataCollection->IndexToName(i)) + "_" + QString::fromStdString(subCollections->IndexToName(d)) + "_" + QString::fromStdString(itemCollections->IndexToName(s));
140  try
141  {
142  if (itemCollections->IndexToName(s) == "DTI" || itemCollections->IndexToName(s) == "DTIFWE")
143  {
144  fileName += ".dti";
146  io->SetFileType( itk::ImageIOBase::Binary );
147  io->UseCompressionOn();
148  TensorImage* tensorImage = dynamic_cast<TensorImage*> (image);
149  MITK_INFO << "Pixeltype Tensor Image: " << tensorImage->GetPixelType().GetPixelTypeAsString();
150  typedef itk::Image<itk::DiffusionTensor3D<TensorScalar>,3> ImageType;
151  typedef itk::ImageFileWriter<ImageType> WriterType;
152  WriterType::Pointer nrrdWriter = WriterType::New();
153  ImageType::Pointer outimage = ImageType::New();
154  CastToItkImage(tensorImage, outimage);
155  nrrdWriter->SetInput( outimage );
156  nrrdWriter->SetImageIO(io);
157  nrrdWriter->SetFileName(fileName.toStdString());
158  nrrdWriter->UseCompressionOn();
159  nrrdWriter->Update();
160  }
161  else if (itemCollections->IndexToName(s) == "FIB")
162  {
163  fileName += ".fib";
164  FiberBundle* fib = dynamic_cast<FiberBundle*> (itemCollections->GetData(s).GetPointer());
165  CoreObjectFactory::FileWriterList fileWriters = CoreObjectFactory::GetInstance()->GetFileWriters();
166  for (CoreObjectFactory::FileWriterList::iterator it = fileWriters.begin() ; it != fileWriters.end() ; ++it)
167  {
168  if ( (*it)->CanWriteBaseDataType(fib) ) {
169  (*it)->SetFileName( fileName.toStdString().c_str() );
170  (*it)->DoWrite( fib );
171  }
172  }
173  }
174  else if (itemCollections->IndexToName(s) == "DWI")
175  {
176  fileName += ".dwi";
177 // NrrdDiffusionImageWriter dwiwriter;
178 // dwiwriter.SetInput( dynamic_cast<mitk::DiffusionImage<short>* > (image));
179 // dwiwriter.SetOutputLocation( fileName.toStdString() );
180 
181  IOUtil::SaveImage(image,fileName.toStdString());
182  }
183  else
184  {
185  fileName += ".nrrd";
186  Image::Pointer image = itemCollections->GetMitkImage(s).GetPointer();
187  IOUtil::SaveImage(image,fileName.toStdString());
188  }
189  }
190  catch( const std::exception& e)
191  {
192  MITK_ERROR << "Caught exception: " << e.what();
193  }
194 
195  std::string relativeFilename = baseFolder.relativeFilePath(fileName).toStdString();
196  xmlFileStream << " <" << ITEM << " " << NAME << "=\"" <<itemCollections->IndexToName(s) << "\" " << FILEPATH << "=\"" << "\" " << LINK << "=\"" << relativeFilename << "\" />\n";
197  }
198  xmlFileStream << " </" << DATA << ">\n";
199  dataId++;
200  }
201 
202  xmlFileStream << " </" << SUBCOLLECTION << ">\n";
203  subColId++;
204  }
205  xmlFileStream << "</" << COLLECTION << ">\n";
206  xmlFileStream.flush();
207  xmlFileStream.close();
208  return true;
209 }
210 
212 {
213  std::vector<std::string> mods;
214  return ExportCollectionToFolder(dataCollection,xmlFile, mods);
215 }
216 
217 bool mitk::CollectionWriter::SaveCollection(mitk::DataCollection *dataCollection, std::vector<std::string> filter, std::string xmlFile)
218 {
219  QDir origFilename = QFileInfo(dataCollection->GetXMLFile().c_str()).absoluteDir();
220  QString originalFolder = origFilename.path() + QDir::separator();
221 
222  if (xmlFile == "")
223  xmlFile = dataCollection->GetXMLFile();
224 
225  QDir fileName = QFileInfo(xmlFile.c_str()).absoluteDir();
226  std::string outputFolder = fileName.path().toStdString() + QDir::separator().toLatin1();
227  QDir baseFolder(outputFolder.c_str());
228 
229  std::ofstream xmlFileStream;
230  xmlFileStream.open (xmlFile.c_str());
231  xmlFileStream << "<!-- MITK - DataCollection - File Version 1.0 --> \n";
232  xmlFileStream << "<" << COLLECTION << " " << NAME << "=\"" << dataCollection->GetName() << "\" >\n";
233  unsigned int subColId = 0;
234 
235  unsigned int dataId = 0;
236 
237  QDir dir(QString::fromStdString(outputFolder));
238  for (size_t i = 0 ; i < dataCollection->Size(); ++i)
239  {
240  // Write Subcollection tag
241  xmlFileStream << " <" << SUBCOLLECTION << " " << NAME << "=\"" << dataCollection->IndexToName(i) << "\" " << FILEPATH << "=\"" << dataCollection->GetDataFilePath(i) << "\" id=\"Col" << subColId << "\" >\n";
242  // Create Sub-Folder
243  dir.mkpath(QString::fromStdString(dataCollection->IndexToName(i)));
244 
245  // Herein create data folders
246  DataCollection* subCollections = dynamic_cast<DataCollection*> (dataCollection->GetData(i).GetPointer());
247  if (subCollections == NULL)
248  {
249  MITK_ERROR<< "mitk::CollectionWriter::SaveCollectionToFolder: Container is illformed. Aborting";
250  return false;
251  }
252 
253  for (size_t d = 0; d < subCollections->Size(); d++ )
254  {
255  // Create Sub Paths
256  QString subPath = QString::fromStdString(dataCollection->IndexToName(i))+"/"+QString::fromStdString(subCollections->IndexToName(d));
257  dir.mkpath(subPath);
258  xmlFileStream << " <" << DATA << " " << NAME << "=\"" << subCollections->IndexToName(d) << "\" " << FILEPATH << "=\"" << subCollections->GetDataFilePath(d) << "\" id=\"Data" << dataId << "\" >\n";
259 
260  DataCollection* itemCollections = dynamic_cast<DataCollection*> (subCollections->GetData(d).GetPointer());
261  if (itemCollections == NULL)
262  {
263  MITK_ERROR<< "mitk::CollectionWriter::SaveCollectionToFolder: Container is illformed. Aborting";
264  return false;
265  }
266 
267  for (size_t s = 0; s < itemCollections->Size(); s++)
268  {
269  if (filter.size() > 0)
270  {
271  bool isSelected = false;
272  for (size_t f = 0; f < filter.size(); f++)
273  {
274  if (filter.at(f) == itemCollections->IndexToName(s) )
275  {
276  isSelected = true;
277  break;
278  }
279  }
280  if (isSelected == false)
281  continue;
282  }
283  Image* image = dynamic_cast<Image*> (itemCollections->GetData(s).GetPointer());
284  QString fileName;
285  bool fullName = false;
286  if (itemCollections->GetDataFilePath(s) != "")
287  {
288  fileName = originalFolder + QString::fromStdString(itemCollections->GetDataFilePath(s));
289  fullName = true;
290  MITK_INFO << "original path: " << itemCollections->GetDataFilePath(s) ;
291  }
292  else
293  fileName = dir.path() + dir.separator() + subPath + dir.separator() + QString::fromStdString(dataCollection->IndexToName(i)) + "_" + QString::fromStdString(subCollections->IndexToName(d)) + "_" + QString::fromStdString(itemCollections->IndexToName(s));
294 
295  try
296  {
297  if (itemCollections->IndexToName(s) == "DTI" || itemCollections->IndexToName(s) == "DTIFWE")
298  {
299  if (!fullName)
300  fileName += ".dti";
302  io->SetFileType( itk::ImageIOBase::Binary );
303  io->UseCompressionOn();
304  TensorImage* tensorImage = dynamic_cast<TensorImage*> (image);
305  MITK_INFO << "Pixeltype Tensor Image: " << tensorImage->GetPixelType().GetPixelTypeAsString();
306  typedef itk::Image<itk::DiffusionTensor3D<TensorScalar>,3> ImageType;
307  typedef itk::ImageFileWriter<ImageType> WriterType;
308  WriterType::Pointer nrrdWriter = WriterType::New();
309  ImageType::Pointer outimage = ImageType::New();
310  CastToItkImage(tensorImage, outimage);
311  nrrdWriter->SetInput( outimage );
312  nrrdWriter->SetImageIO(io);
313  nrrdWriter->SetFileName(fileName.toStdString());
314  nrrdWriter->UseCompressionOn();
315  nrrdWriter->Update();
316  }
317  else if (itemCollections->IndexToName(s) == "FIB")
318  {
319  if (!fullName)
320  fileName += ".fib";
321  FiberBundle* fib = dynamic_cast<FiberBundle*> (itemCollections->GetData(s).GetPointer());
322  CoreObjectFactory::FileWriterList fileWriters = CoreObjectFactory::GetInstance()->GetFileWriters();
323  for (CoreObjectFactory::FileWriterList::iterator it = fileWriters.begin() ; it != fileWriters.end() ; ++it)
324  {
325  if ( (*it)->CanWriteBaseDataType(fib) ) {
326  (*it)->SetFileName( fileName.toStdString().c_str() );
327  (*it)->DoWrite( fib );
328  }
329  }
330  }
331  else if (itemCollections->IndexToName(s) == "DWI")
332  {
333  if (!fullName)
334  fileName += ".dwi";
335  IOUtil::SaveImage(image,fileName.toStdString());
336  }
337  else
338  {
339  if (!fullName)
340  fileName += ".nrrd";
341  Image::Pointer image = itemCollections->GetMitkImage(s).GetPointer();
342  IOUtil::SaveImage(image,fileName.toStdString());
343  }
344  }
345  catch( const std::exception& e)
346  {
347  MITK_ERROR << "Caught exception: " << e.what();
348  }
349 
350  std::string relativeFilename =baseFolder.relativeFilePath(fileName).toStdString();
351  xmlFileStream << " <" << ITEM << " " << NAME << "=\"" <<itemCollections->IndexToName(s) << "\" " << FILEPATH << "=\"" << "\" " << LINK << "=\"" << relativeFilename << "\" />\n";
352  }
353  xmlFileStream << " </" << DATA << ">\n";
354  dataId++;
355  }
356 
357  xmlFileStream << " </" << SUBCOLLECTION << ">\n";
358  subColId++;
359  }
360  xmlFileStream << "</" << COLLECTION << ">\n";
361  xmlFileStream.flush();
362  xmlFileStream.close();
363  return true;
364 }
365 
366 bool mitk::CollectionWriter::FolderToXml(std::string folder, std::string collectionType, std::string xmlFile, std::vector<std::string> filter, std::vector<std::string> seriesNames)
367 {
368  // 1) Parse for folders
369 
370  QDir parseDir;
371  parseDir.setFilter( QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
372  parseDir.setPath(QString::fromStdString(folder));
373 
374  QFileInfoList qFileList = parseDir.entryInfoList();
375 
376 
377  std::ofstream xmlFileStream;
378  xmlFileStream.open (xmlFile.c_str());
379  xmlFileStream << "<!-- MITK - DataCollection - File Version 1.0 --> \n";
380  xmlFileStream << "<" << COLLECTION << " " << NAME << "=\"" << "GEN" << "\" >\n";
381 
382  unsigned int dataId = 0;
383 
384  // now populate lists with files names, non-existing files will be marked with an empty string
385  for (int i = 0; i < qFileList.size(); ++i)
386  {
387  // 2) For Each sub folder construct collectionType sub-folder
388  std::string baseFolder = qFileList.at(i).absoluteFilePath().toStdString() + QDir::separator().toLatin1() + collectionType;
389 
390  MITK_INFO << "Processing : " << baseFolder;
391  if (!QFileInfo(QString::fromStdString(baseFolder)).isDir())
392  {
393  MITK_WARN << "Not a valid folder, skipping.";
394  continue;
395  }
396 
397  // 3) Parse each sub folder and extend XML file
398  // Parse folder and look up all data,
399  // after sanitation only fully available groups are included (that is all suffixes are found)
400 
402  if (fileList.size() <= 0 || fileList.at(0).size() <= 0)
403  continue;
404 
405  // Write Subcollection tag
406  // try to extract date out of filename
407  std::string name = GetName(fileList.at(0).at(0),filter.at(0));
408  xmlFileStream << " <" << SUBCOLLECTION << " " << NAME << "=\"" << name << "\" " << FILEPATH << "=\"\" id=\"Col" << i << "\" >\n";
409 
410 
411  for (unsigned int k=0; k < fileList.at(0).size(); ++k) // all groups have the same amount of items, so looking at 0 is ok.
412  {
413  std::string strDate = GetDate(fileList.at(0).at(k),filter.at(0));
414  xmlFileStream << " <" << DATA << " " << NAME << "=\"" << strDate << "\" " << " id=\"Data" << dataId << "\" >\n";
415  dataId++;
416  for (unsigned int i=0; i< filter.size(); ++i)
417  {
418  std::string fileName = fileList.at(i).at(k);
419  xmlFileStream << " <" << ITEM << " " << NAME << "=\"" << seriesNames.at(i) << "\" " << LINK << "=\"" << fileName << "\" />\n";
420  }
421  xmlFileStream << " </" << DATA << ">\n" ;
422  }
423  xmlFileStream << " </" << SUBCOLLECTION << ">\n";
424  }
425 
426  xmlFileStream << "</" << COLLECTION << ">\n";
427  xmlFileStream.flush();
428  xmlFileStream.close();
429 
430  return true;
431 }
432 
433 bool mitk::CollectionWriter::SingleFolderToXml(std::string folder, std::string xmlFile, std::vector<std::string> filter, std::vector<std::string> seriesNames, bool longDate, int skipUntil, float months)
434 {
435  std::ofstream xmlFileStream;
436  xmlFileStream.open (xmlFile.c_str());
437  xmlFileStream << "<!-- MITK - DataCollection - File Version 1.0 --> \n";
438  xmlFileStream << "<" << COLLECTION << " " << NAME << "=\"" << "GEN" << "\" >\n";
439 
440  unsigned int dataId = 0;
441 
442  // 1)
443  // Parse folder and look up all data,
444  // after sanitation only fully available groups are included (that is all suffixes are found)
445 
447 
448  // Write Subcollection tag
449  // try to extract date out of filename
450  std::string name = GetName(fileList.at(0).at(0),filter.at(0),longDate);
451  xmlFileStream << " <" << SUBCOLLECTION << " " << NAME << "=\"" << name << "\" " << FILEPATH << "=\"\" id=\"Col" << 0 << "\" >\n";
452 
453 
454  for (unsigned int k=skipUntil; k < fileList.at(0).size(); ++k) // all groups have the same amount of items, so looking at 0 is ok.
455  {
456  std::string strDate = GetDate(fileList.at(0).at(k),filter.at(0),true);
457  xmlFileStream << " <" << DATA << " " << NAME << "=\"" << strDate << "\" " << " id=\"Data" << dataId << "\" >\n";
458  dataId++;
459  for (unsigned int i=0; i< filter.size(); ++i)
460  {
461  std::string fileName = fileList.at(i).at(k);
462  xmlFileStream << " <" << ITEM << " " << NAME << "=\"" << seriesNames.at(i) << "\" " << LINK << "=\"" << fileName << "\" />\n";
463  }
464 
465  // size_t ind = GetIndexForinXMonths(fileList,months,k,filter);
466  // xmlFileStream << " <" << ITEM << " " << NAME << "=\"TARGET\" " << LINK << "=\"" << fileList.at(filter.size()-1).at(ind) << "\" />\n";
467 
468  xmlFileStream << " </" << DATA << ">\n" ;
469  // check if target still exists for next step
470  if (GetIndexForinXMonths(fileList,months,k+1,filter)== 0)
471  break;
472  }
473  xmlFileStream << " </" << SUBCOLLECTION << ">\n";
474 
475  xmlFileStream << "</" << COLLECTION << ">\n";
476  xmlFileStream.flush();
477  xmlFileStream.close();
478 
479  return true;
480 }
481 
482 size_t mitk::CollectionWriter::GetIndexForinXMonths(mitk::CollectionReader::FileListType fileList,float months, size_t curIndex,std::vector<std::string> filter)
483 {
484  std::string strDate0 = GetDate(fileList.at(0).at(curIndex),filter.at(0),true);
485 
486  int year0 =std::atoi(strDate0.substr(0,4).c_str());
487  int month0 =std::atoi(strDate0.substr(5,2).c_str());
488  int day0 = std::atoi(strDate0.substr(8,2).c_str());
489 
490  size_t bestIndex = 0;
491  int bestFit = 1e5;
492 
493  for (size_t i=curIndex+1; i < fileList.at(0).size(); ++i)
494  {
495  std::string strDate = GetDate(fileList.at(0).at(i),filter.at(0),true);
496  int year =std::atoi(strDate.substr(0,4).c_str());
497  int month =std::atoi(strDate.substr(5,2).c_str());
498  int day = std::atoi(strDate.substr(8,2).c_str());
499 
500  int fit = std::fabs((months * 30 ) - (((year-year0)*360) +((month-month0)*30) + (day-day0))); // days difference from x months
501  if (fit < bestFit)
502  {
503  bestFit = fit;
504  bestIndex = i;
505  }
506  }
507  return bestIndex;
508 }
itk::SmartPointer< Self > Pointer
#define MITK_INFO
Definition: mitkLogMacros.h:22
const std::string NAME
static FileListType GenerateFileLists(std::string folder, std::vector< std::string > suffixes, bool allowGaps=false)
GenerateFileLists Returns a collection of lists with valid files names in a folder.
#define MITK_ERROR
Definition: mitkLogMacros.h:24
static bool SaveCollection(DataCollection *dataCollection, std::vector< std::string > filter, std::string xmlFile="")
SaveCollection - Stores data collection at original location.
const std::string SUBCOLLECTION
std::string GetPixelTypeAsString() const
Returns a string containing the ITK pixel type name.
vcl_size_t Size() const
Size - number of data items in collection.
static FileListType SanitizeFileList(FileListType list)
SanitizeFileList Removes all entries that are lacking at least one modality.
const std::string COLLECTION
std::string GetName() const
mitk::Image::Pointer GetMitkImage(vcl_size_t index)
GetMitkImage - casts data to mitk::Image and returns it.
static std::string GetDate(std::string fileName, std::string suffix, bool longName=false)
static bool SaveImage(mitk::Image::Pointer image, const std::string &path)
SaveImage Convenience method to save an arbitrary mitkImage.
Definition: mitkIOUtil.cpp:870
std::vector< std::vector< std::string > > FileListType
map::core::discrete::Elements< 3 >::InternalImageType ImageType
#define MITK_WARN
Definition: mitkLogMacros.h:23
std::string IndexToName(vcl_size_t index) const
IndexToName - Get name from index.
static bool SingleFolderToXml(std::string folder, std::string xmlFile, std::vector< std::string > filter, std::vector< std::string > seriesNames, bool longDate=true, int skipUntil=0, float months=0)
Image class for storing images.
Definition: mitkImage.h:76
const std::string ID
Base Class for Fiber Bundles;.
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
Definition: mitkImage.cpp:105
static bool ExportCollectionToFolder(DataCollection *dataCollection, std::string xmlFile, std::vector< std::string > filter)
ExportCollectionToFolder.
const std::string FILEPATH
static bool FolderToXml(std::string folder, std::string collectionType, std::string xmlFile, std::vector< std::string > filter, std::vector< std::string > seriesNames)
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
std::string GetXMLFile()
SetXMLFile - gets xml file to which data collection is supposed to be saved.
const std::string LINK
this class encapsulates tensor images
itk::DataObject::Pointer GetData(vcl_size_t index)
GetData Get original data by index.
std::string GetDataFilePath(vcl_size_t index) const
const std::string DATA
static std::string GetName(std::string fileName, std::string suffix, bool longName=false)
std::list< mitk::FileWriterWithInformation::Pointer > FileWriterList
const std::string ITEM
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.