16 #include <vtkCubeSource.h> 20 #include <vtkSmartPointer.h> 54 std::vector<mitk::MimeType> mimetypesForFile = mimeTypeProvider->GetMimeTypesForFile(usResource.
GetResourcePath());
59 std::vector<mitk::MimeType> mimetypes;
61 std::sort(mimetypesForFile.begin(), mimetypesForFile.end());
62 std::sort(mimetypesForSurface.begin(), mimetypesForSurface.end());
63 std::set_intersection(mimetypesForFile.begin(), mimetypesForFile.end(),
64 mimetypesForSurface.begin(), mimetypesForSurface.end(),
65 std::back_inserter(mimetypes));
68 if (mimetypes.empty())
75 std::vector<us::ServiceReference<mitk::IFileReader>> refs = fileReaderRegistry.
GetReferences(mimetypes[0]);
84 auto basedatas = reader->
Read();
85 if (!basedatas.empty())
87 surface =
dynamic_cast<mitk::Surface*
>(basedatas.front().GetPointer());
106 MITK_ERROR <<
"No tracking device service found!";
122 if (filename.compare(
"cube") == 0){
123 vtkSmartPointer<vtkCubeSource> cubeSource = vtkSmartPointer<vtkCubeSource>::New();
125 bounds[0] = bounds[2] = bounds[4] = -400.0;
126 bounds[1] = bounds[3] = bounds[5] = 400.0;
128 cubeSource->SetBounds(bounds);
129 cubeSource->Update();
131 output->SetVtkPolyData(cubeSource->GetOutput());
134 if (filename.compare(
"") == 0)
137 vtkSmartPointer<vtkPolyData> emptyPolyData = vtkSmartPointer<vtkPolyData>::New();
138 output->SetVtkPolyData(emptyPolyData);
154 if (fileoutput ==
nullptr)
157 output->SetVtkPolyData(vtkSmartPointer<vtkPolyData>(vtkPolyData::New()));
161 output->SetVtkPolyData(fileoutput->GetVtkPolyData());
170 MITK_ERROR <<
"No tracking device service found!";
mitk::TrackingDeviceData GetTrackingDeviceData() const
Class for storing surfaces (vtkPolyData).
static IMimeTypeProvider * GetMimeTypeProvider(us::ModuleContext *context=us::GetModuleContext())
Get an IMimeTypeProvider instance.
mitk::IFileReader * GetReader(const ReaderReference &ref, us::ModuleContext *context=us::GetModuleContext())
void SetTrackingDevice(mitk::TrackingDevice::Pointer tracker)
Deprecated! Use set DeviceData instead. Sets the tracking device type of the volume. After doing this the tracking volume gets generated and is set to the correct dimensions in the correct coordinate system. The TV of a VirtualTrackingDevice is always a 400*400 cube.
This class is a collection for information of all Tracking Device Types (derived from abstract Tracki...
mitk::TrackingDeviceType GetTrackingDeviceType() const
void SetTrackingDeviceType(mitk::TrackingDeviceType deviceType)
Deprecated! Use set DeviceData instead. Sets the tracking device type of the volume. Warning: there are different possible volumes for some device types. In this case a default volume is chosen automatically. All tracking volumes are defined by TrackingDeviceData objects (see file mitkTrackingTypes.h) for a list.
virtual std::vector< itk::SmartPointer< BaseData > > Read()=0
Reads the specified file or input stream and returns its contents.
void * GetService(const ServiceReferenceBase &reference)
void SetTrackingDeviceData(mitk::TrackingDeviceData deviceData)
Sets the tracking device data object which will be used to generate the volume. Each tracking device ...
virtual void SetInput(const std::string &location)=0
Set the input location.
TrackingDeviceData GetFirstCompatibleDeviceDataForLine(TrackingDeviceType type)
Module * GetModule() const
ModuleResource GetResource(const std::string &path) const
std::vector< ServiceReferenceU > GetServiceReferences(const std::string &clazz, const std::string &filter=std::string())
std::string VolumeModelLocation
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
std::string TrackingDeviceType
std::string GetResourcePath() const
A RAII helper class for core service objects.
static std::vector< ReaderReference > GetReferences(const MimeType &mimeType, us::ModuleContext *context=us::GetModuleContext())
The common interface for all MITK file readers.
void GenerateData() override
mitk::TrackingDeviceData m_Data
Holds the current tracking device data object, which is used to generate the volume.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
TrackingVolumeGenerator()
static std::string CATEGORY_SURFACES()