Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkDummyLsetReader.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 #include <mitkDummyLsetReader.h>
17 #include <itksys/SystemTools.hxx>
18 #include <itkImageFileReader.h>
19 #include <itkNrrdImageIO.h>
20 #include <mitkImageCast.h>
21 #include <mitkCustomMimeType.h>
22 
23 typedef itk::Image<unsigned char, 3> ImageType;
24 
25 std::vector<itk::SmartPointer<mitk::BaseData> > mitk::DummyLsetFileReader::Read()
26 {
27 
28  std::vector<itk::SmartPointer<mitk::BaseData> > result;
29  typedef itk::ImageFileReader<ImageType> FileReaderType;
31  reader->SetFileName(this->GetInputLocation());
33  reader->SetImageIO(io);
34  reader->Update();
35 
37  mitk::CastToMitkImage(reader->GetOutput(),img);
38  result.push_back(img.GetPointer());
39 
40  return result;
41 }
42 
43 
45  : AbstractFileReader(other)
46 {
47 }
48 
49 
50 mitk::DummyLsetFileReader* mitk::DummyLsetFileReader::Clone() const
51 {
52  return new DummyLsetFileReader(*this);
53 }
54 
55 
57 {}
58 
59 
61 {
62  CustomMimeType mimeType(this->GetMimeTypePrefix() + "lset");
63  mimeType.AddExtension("lset");
64  mimeType.SetCategory("Images");
65  mimeType.SetComment("Experimental MBI LabelSetImage");
66  this->SetMimeType(mimeType);
67  this->SetDescription("MBI LabelSetImage");
68  this->RegisterService();
69 }
70 
itk::SmartPointer< Self > Pointer
itk::Image< unsigned char, 3 > ImageType
void SetComment(const std::string &comment)
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
void AddExtension(const std::string &extension)
void SetCategory(const std::string &category)
void CastToMitkImage(const itk::SmartPointer< ItkOutputImageType > &itkimage, itk::SmartPointer< mitk::Image > &mitkoutputimage)
Cast an itk::Image (with a specific type) to an mitk::Image.
Definition: mitkImageCast.h:78
Base class for creating mitk::BaseData objects from files or streams.
virtual std::string GetInputLocation() const override
Get the current input location.
virtual std::vector< itk::SmartPointer< BaseData > > Read()
Reads a path or stream and creates a list of BaseData objects.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.