Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkIOMimeTypes.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 "mitkIOMimeTypes.h"
18 
19 #include "mitkCustomMimeType.h"
20 
21 #include "itkGDCMImageIO.h"
22 
23 namespace mitk
24 {
26  {
27  this->AddExtension("gdcm");
28  this->AddExtension("dcm");
29  this->AddExtension("DCM");
30  this->AddExtension("dc3");
31  this->AddExtension("DC3");
32  this->AddExtension("ima");
33  this->AddExtension("img");
34 
36  this->SetComment("DICOM");
37  }
38 
39  bool IOMimeTypes::DicomMimeType::AppliesTo(const std::string &path) const
40  {
41  if (CustomMimeType::AppliesTo(path))
42  return true;
43  // Ask the GDCM ImageIO class directly
45  return gdcmIO->CanReadFile(path.c_str());
46  }
47 
49  std::vector<CustomMimeType *> IOMimeTypes::Get()
50  {
51  std::vector<CustomMimeType *> mimeTypes;
52 
53  // order matters here (descending rank for mime types)
54 
55  mimeTypes.push_back(NRRD_MIMETYPE().Clone());
56  mimeTypes.push_back(NIFTI_MIMETYPE().Clone());
57 
58  mimeTypes.push_back(VTK_IMAGE_MIMETYPE().Clone());
59  mimeTypes.push_back(VTK_PARALLEL_IMAGE_MIMETYPE().Clone());
60  mimeTypes.push_back(VTK_IMAGE_LEGACY_MIMETYPE().Clone());
61 
62  mimeTypes.push_back(DICOM_MIMETYPE().Clone());
63 
64  mimeTypes.push_back(VTK_POLYDATA_MIMETYPE().Clone());
65  mimeTypes.push_back(VTK_PARALLEL_POLYDATA_MIMETYPE().Clone());
66  mimeTypes.push_back(VTK_POLYDATA_LEGACY_MIMETYPE().Clone());
67 
68  mimeTypes.push_back(STEREOLITHOGRAPHY_MIMETYPE().Clone());
69  mimeTypes.push_back(WAVEFRONT_OBJ_MIMETYPE().Clone());
70  mimeTypes.push_back(STANFORD_PLY_MIMETYPE().Clone());
71 
72  mimeTypes.push_back(RAW_MIMETYPE().Clone());
73  mimeTypes.push_back(POINTSET_MIMETYPE().Clone());
74  return mimeTypes;
75  }
76 
78  {
79  CustomMimeType mimeType(VTK_IMAGE_NAME());
80  mimeType.AddExtension("vti");
81  mimeType.SetCategory(CATEGORY_IMAGES());
82  mimeType.SetComment("VTK Image");
83  return mimeType;
84  }
85 
87  {
89  mimeType.AddExtension("vtk");
90  mimeType.SetCategory(CATEGORY_IMAGES());
91  mimeType.SetComment("VTK Legacy Image");
92  return mimeType;
93  }
94 
96  {
98  mimeType.AddExtension("pvti");
99  mimeType.SetCategory(CATEGORY_IMAGES());
100  mimeType.SetComment("VTK Parallel Image");
101  return mimeType;
102  }
103 
105  {
106  CustomMimeType mimeType(VTK_POLYDATA_NAME());
107  mimeType.AddExtension("vtp");
108  mimeType.SetCategory(CATEGORY_SURFACES());
109  mimeType.SetComment("VTK PolyData");
110  return mimeType;
111  }
112 
114  {
116  mimeType.AddExtension("vtk");
117  mimeType.SetCategory(CATEGORY_SURFACES());
118  mimeType.SetComment("VTK Legacy PolyData");
119  return mimeType;
120  }
121 
123  {
125  mimeType.AddExtension("pvtp");
126  mimeType.SetCategory(CATEGORY_SURFACES());
127  mimeType.SetComment("VTK Parallel PolyData");
128  return mimeType;
129  }
130 
132  {
134  mimeType.AddExtension("stl");
135  mimeType.SetCategory(CATEGORY_SURFACES());
136  mimeType.SetComment("Stereolithography");
137  return mimeType;
138  }
139 
141  {
143  mimeType.AddExtension("obj");
144  mimeType.SetCategory(CATEGORY_SURFACES());
145  mimeType.SetComment("Wavefront OBJ");
146  return mimeType;
147  }
148 
150  {
151  CustomMimeType mimeType(STANFORD_PLY_NAME());
152  mimeType.AddExtension("ply");
153  mimeType.SetCategory(CATEGORY_SURFACES());
154  mimeType.SetComment("Stanford PLY");
155  return mimeType;
156  }
157 
159  {
160  static std::string name = DEFAULT_BASE_NAME() + ".stl";
161  return name;
162  }
163 
165  {
166  static std::string name = DEFAULT_BASE_NAME() + ".obj";
167  return name;
168  }
169 
171  {
172  static std::string name = DEFAULT_BASE_NAME() + ".ply";
173  return name;
174  }
175 
177  {
178  static std::string name = "application/vnd.mitk";
179  return name;
180  }
181 
183  {
184  static std::string cat = "Images";
185  return cat;
186  }
187 
189  {
190  static std::string cat = "Surfaces";
191  return cat;
192  }
193 
195  {
196  static std::string name = DEFAULT_BASE_NAME() + ".vtk.image";
197  return name;
198  }
199 
201  {
202  static std::string name = DEFAULT_BASE_NAME() + ".vtk.image.legacy";
203  return name;
204  }
205 
207  {
208  static std::string name = DEFAULT_BASE_NAME() + ".vtk.parallel.image";
209  return name;
210  }
211 
213  {
214  static std::string name = DEFAULT_BASE_NAME() + ".vtk.polydata";
215  return name;
216  }
217 
219  {
220  static std::string name = DEFAULT_BASE_NAME() + ".vtk.polydata.legacy";
221  return name;
222  }
223 
225  {
226  static std::string name = DEFAULT_BASE_NAME() + ".vtk.parallel.polydata";
227  return name;
228  }
229 
231  {
233  mimeType.AddExtension("nrrd");
234  mimeType.AddExtension("nhdr");
235  mimeType.SetCategory("Images");
236  mimeType.SetComment("NRRD");
237  return mimeType;
238  }
239 
241  {
243  mimeType.AddExtension("nii");
244  mimeType.AddExtension("nii.gz");
245  mimeType.AddExtension("hdr");
246  mimeType.AddExtension("hdr.gz");
247  mimeType.AddExtension("img");
248  mimeType.AddExtension("img.gz");
249  mimeType.AddExtension("nia");
250  mimeType.SetCategory("Images");
251  mimeType.SetComment("Nifti");
252  return mimeType;
253  }
254 
256  {
257  CustomMimeType mimeType(RAW_MIMETYPE_NAME());
258  mimeType.AddExtension("raw");
259  mimeType.SetCategory("Images");
260  mimeType.SetComment("Raw data");
261  return mimeType;
262  }
263 
266  {
267  static std::string name = DEFAULT_BASE_NAME() + ".image.nrrd";
268  return name;
269  }
270 
272  {
273  static std::string name = DEFAULT_BASE_NAME() + ".image.nifti";
274  return name;
275  }
276 
278  {
279  static std::string name = DEFAULT_BASE_NAME() + ".image.raw";
280  return name;
281  }
282 
284  {
285  static std::string name = DEFAULT_BASE_NAME() + ".image.dicom";
286  return name;
287  }
288 
290  {
292  mimeType.AddExtension("mps");
293  mimeType.SetCategory("Point Sets");
294  mimeType.SetComment("MITK Point Set");
295  return mimeType;
296  }
297 
299  {
300  static std::string name = DEFAULT_BASE_NAME() + ".pointset";
301  return name;
302  }
303 
305  {
306  mitk::CustomMimeType mimeType(DEFAULT_BASE_NAME() + ".geometrydata");
307  mimeType.AddExtension("mitkgeometry");
308  mimeType.SetCategory("Geometries");
309  mimeType.SetComment("GeometryData object");
310  return mimeType;
311  }
312 }
itk::SmartPointer< Self > Pointer
Pointer Clone() const
static std::vector< CustomMimeType * > Get()
static std::string WAVEFRONT_OBJ_NAME()
static CustomMimeType NRRD_MIMETYPE()
static std::string VTK_PARALLEL_POLYDATA_NAME()
static CustomMimeType VTK_POLYDATA_LEGACY_MIMETYPE()
static CustomMimeType VTK_IMAGE_LEGACY_MIMETYPE()
DataCollection - Class to facilitate loading/accessing structured data.
static std::string VTK_IMAGE_LEGACY_NAME()
static std::string VTK_POLYDATA_NAME()
virtual bool AppliesTo(const std::string &path) const override
Checks if the MimeType can handle file at the given location.
static CustomMimeType VTK_PARALLEL_POLYDATA_MIMETYPE()
static std::string VTK_IMAGE_NAME()
static CustomMimeType VTK_IMAGE_MIMETYPE()
virtual bool AppliesTo(const std::string &path) const
Checks if the MimeType can handle file at the given location.
static std::string STEREOLITHOGRAPHY_NAME()
virtual DicomMimeType * Clone() const override
void SetComment(const std::string &comment)
static CustomMimeType VTK_POLYDATA_MIMETYPE()
static CustomMimeType POINTSET_MIMETYPE()
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
static std::string DICOM_MIMETYPE_NAME()
static std::string CATEGORY_IMAGES()
static std::string NIFTI_MIMETYPE_NAME()
static CustomMimeType STEREOLITHOGRAPHY_MIMETYPE()
static std::string DEFAULT_BASE_NAME()
static std::string RAW_MIMETYPE_NAME()
static CustomMimeType RAW_MIMETYPE()
static DicomMimeType DICOM_MIMETYPE()
static CustomMimeType WAVEFRONT_OBJ_MIMETYPE()
static CustomMimeType NIFTI_MIMETYPE()
static std::string VTK_PARALLEL_IMAGE_NAME()
void AddExtension(const std::string &extension)
void SetCategory(const std::string &category)
static std::string POINTSET_MIMETYPE_NAME()
static std::string VTK_POLYDATA_LEGACY_NAME()
static std::string STANFORD_PLY_NAME()
static CustomMimeType STANFORD_PLY_MIMETYPE()
static CustomMimeType VTK_PARALLEL_IMAGE_MIMETYPE()
static std::string NRRD_MIMETYPE_NAME()
static CustomMimeType GEOMETRY_DATA_MIMETYPE()
static std::string CATEGORY_SURFACES()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.