Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerTerminologiesModuleLogic.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  This file was originally developed by Csaba Pinter, PerkLab, Queen's University
18  and was supported through the Applied Cancer Research Unit program of Cancer Care
19  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
20 
21 ==============================================================================*/
22 
23 #ifndef __vtkSlicerTerminologiesModuleLogic_h
24 #define __vtkSlicerTerminologiesModuleLogic_h
25 
26 // Slicer includes
27 #include "vtkSlicerModuleLogic.h"
28 
29 #include "vtkSlicerTerminologiesModuleLogicExport.h"
30 
31 #include <vtkVector.h>
32 
33 class vtkStringArray;
37 
39 class VTK_SLICER_TERMINOLOGIES_LOGIC_EXPORT vtkSlicerTerminologiesModuleLogic :
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
46 
49  {
50  public:
52  : CodingSchemeDesignator("")
53  , CodeValue("")
54  , CodeMeaning("")
55  { };
56  CodeIdentifier(std::string codingSchemeDesignator, std::string codeValue, std::string codeMeaning)
57  : CodingSchemeDesignator(codingSchemeDesignator)
58  , CodeValue(codeValue)
59  , CodeMeaning(codeMeaning)
60  { };
61  std::string CodingSchemeDesignator;
62  std::string CodeValue;
63  std::string CodeMeaning; // Human readable name (not required for ID)
64  };
65 
71  bool LoadContextFromFile(std::string filePath);
75  std::string LoadTerminologyFromFile(std::string filePath);
79  std::string LoadAnatomicContextFromFile(std::string filePath);
84  bool LoadTerminologyFromSegmentDescriptorFile(std::string contextName, std::string filePath);
87  bool LoadAnatomicContextFromSegmentDescriptorFile(std::string contextName, std::string filePath);
88 
90  void GetLoadedTerminologyNames(std::vector<std::string> &terminologyNames);
92  void GetLoadedTerminologyNames(vtkStringArray* terminologyNames);
94  void GetLoadedAnatomicContextNames(std::vector<std::string> &anatomicContextNames);
96  void GetLoadedAnatomicContextNames(vtkStringArray* anatomicContextNames);
97 
103  bool GetCategoriesInTerminology(std::string terminologyName, std::vector<CodeIdentifier>& categories);
108  bool FindCategoriesInTerminology(std::string terminologyName, std::vector<CodeIdentifier>& categories, std::string search);
112  bool GetCategoryInTerminology(std::string terminologyName, CodeIdentifier categoryId, vtkSlicerTerminologyCategory* categoryObject);
113 
119  bool GetTypesInTerminologyCategory(std::string terminologyName, CodeIdentifier categoryId, std::vector<CodeIdentifier>& types);
124  bool FindTypesInTerminologyCategory(std::string terminologyName, CodeIdentifier categoryId, std::vector<CodeIdentifier>& types, std::string search);
128  bool GetTypeInTerminologyCategory(std::string terminologyName, CodeIdentifier categoryId, CodeIdentifier typeId, vtkSlicerTerminologyType* typeObject);
129 
134  bool GetTypeModifiersInTerminologyType(std::string terminologyName, CodeIdentifier categoryId, CodeIdentifier typeId, std::vector<CodeIdentifier>& typeModifiers);
138  bool GetTypeModifierInTerminologyType(std::string terminologyName,
139  CodeIdentifier categoryId, CodeIdentifier typeId, CodeIdentifier modifierId, vtkSlicerTerminologyType* typeModifier);
140 
146  bool GetRegionsInAnatomicContext(std::string anatomicContextName, std::vector<CodeIdentifier>& regions);
150  bool FindRegionsInAnatomicContext(std::string anatomicContextName, std::vector<CodeIdentifier>& regions, std::string search);
154  bool GetRegionInAnatomicContext(std::string anatomicContextName, CodeIdentifier regionId, vtkSlicerTerminologyType* regionObject);
155 
160  bool GetRegionModifiersInAnatomicRegion(std::string anatomicContextName, CodeIdentifier regionId, std::vector<CodeIdentifier>& regionModifiers);
164  bool GetRegionModifierInAnatomicRegion(std::string anatomicContextName,
165  CodeIdentifier regionId, CodeIdentifier modifierId, vtkSlicerTerminologyType* regionModifier);
166 
172  bool FindTypeInTerminologyBy3dSlicerLabel(std::string terminologyName, std::string slicerLabel, vtkSlicerTerminologyEntry* entry);
173 
175  static CodeIdentifier CodeIdentifierFromTerminologyCategory(vtkSlicerTerminologyCategory* category);
177  static CodeIdentifier CodeIdentifierFromTerminologyType(vtkSlicerTerminologyType* type);
178 
182  static std::string SerializeTerminologyEntry(vtkSlicerTerminologyEntry* entry);
183 
187  static std::string SerializeTerminologyEntry(
188  std::string terminologyContextName,
189  std::string categoryValue, std::string categorySchemeDesignator, std::string categoryMeaning,
190  std::string typeValue, std::string typeSchemeDesignator, std::string typeMeaning,
191  std::string modifierValue, std::string modifierSchemeDesignator, std::string modifierMeaning,
192  std::string anatomicContextName,
193  std::string regionValue, std::string regionSchemeDesignator, std::string regionMeaning,
194  std::string regionModifierValue, std::string regionModifierSchemeDesignator, std::string regionModifierMeaning );
195 
200  bool DeserializeTerminologyEntry(std::string serializedEntry, vtkSlicerTerminologyEntry* entry);
201 
202 public:
203  vtkGetStringMacro(UserContextsPath);
204  vtkSetStringMacro(UserContextsPath);
205 
206 protected:
209 
210  virtual void SetMRMLSceneInternal(vtkMRMLScene* newScene) VTK_OVERRIDE;
211 
213  void LoadDefaultTerminologies();
215  void LoadDefaultAnatomicContexts();
217  void LoadUserContexts();
218 
219 protected:
222 
223 private:
225  void operator=(const vtkSlicerTerminologiesModuleLogic&); // Not implemented
226 
227  class vtkInternal;
228  vtkInternal* Internal;
229  friend class vtkInternal;
230 };
231 
232 #endif
static vtkSlicerModuleLogic * New()
The Usual vtk class functions.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
Information needed to uniquely identify a terminology code.
Terminology property type object.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
char * UserContextsPath
The path from which the json files are automatically loaded on startup.
CodeIdentifier(std::string codingSchemeDesignator, std::string codeValue, std::string codeMeaning)
Terminology property category object.