Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkSlicerScriptedFileReaderBridge.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
6 Queen's University, Kingston, ON, Canada. All Rights Reserved.
7
8 See COPYRIGHT.txt
9 or http://www.slicer.org/copyright/copyright.txt for details.
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16
17==============================================================================*/
18
19#ifndef __vtkSlicerScriptedFileReaderBridge_h
20#define __vtkSlicerScriptedFileReaderBridge_h
21
22// Slicer includes
23#include "vtkSlicerBaseLogicExport.h"
24
25// MRML includes
26#include <vtkMRMLFileReader.h>
27
28// VTK includes
29#include <vtkPython.h>
30
31// STD includes
32#include <string>
33#include <vector>
34
35class vtkSmartPyObject;
36class vtkWeakReference;
37
47class VTK_SLICER_BASE_LOGIC_EXPORT vtkSlicerScriptedFileReaderBridge : public vtkMRMLFileReader
48{
49public:
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
54 bool CanLoadFile(const std::string& filePath) override;
55 double CanLoadFileConfidence(const std::string& filePath) override;
56 bool Load(vtkMRMLIOProperties* properties) override;
58 std::string ExamineFileList(std::vector<std::string>& fileList, vtkMRMLIOProperties* ioProperties) override;
60 double ExamineFileListConfidence(std::vector<std::string>& fileList, vtkMRMLIOProperties* ioProperties) override;
62
66 vtkWeakReference* GetWeakReference();
67
72 static void UpdatePropertiesFromDict(vtkMRMLIOProperties* properties, PyObject* dict);
74
75protected:
78
82 void UnRegisterInternal(vtkObjectBase* o, vtkTypeBool check) override;
83
84private:
86 void operator=(const vtkSlicerScriptedFileReaderBridge&) = delete;
87
92 PyObject* CallPythonMethod(const vtkSmartPyObject& pyArgs, const std::string& fName, bool decrementResult, bool* callFailed = nullptr);
93
94 class vtkInternal;
95 vtkInternal* Internal;
96};
97
98#endif
double ExamineFileListConfidence(std::vector< std::string > &fileList, vtkMRMLIOProperties *ioProperties) override
The file list is passed to the Python method as a list, which the method must modify in place.
static PyObject * PropertiesToDict(vtkMRMLIOProperties *properties)
vtkWeakReference * GetWeakReference()
bool CanLoadFile(const std::string &filePath) override
double CanLoadFileConfidence(const std::string &filePath) override
bool Load(vtkMRMLIOProperties *properties) override
static void UpdatePropertiesFromDict(vtkMRMLIOProperties *properties, PyObject *dict)
void UnRegisterInternal(vtkObjectBase *o, vtkTypeBool check) override
std::string ExamineFileList(std::vector< std::string > &fileList, vtkMRMLIOProperties *ioProperties) override
The file list is passed to the Python method as a list, which the method must modify in place.
void PrintSelf(ostream &os, vtkIndent indent) override
void GetOptionsDescription(vtkMRMLIOOptionsDescription *description) override
static vtkSlicerScriptedFileReaderBridge * New()
_object PyObject