Commit 2594556f3f4daeab27f23c1e7c04fccc942cca88
1 parent
30840beb
Exists in
master
and in
6 other branches
ENH: Save inv3 project structure
Showing
3 changed files
with
9 additions
and
8 deletions
Show diff stats
invesalius/data/mask.py
... | ... | @@ -45,7 +45,7 @@ class Mask(): |
45 | 45 | if isinstance(d[key], vtk.vtkImageData): |
46 | 46 | img_name = '%s_%s.vti' % (filename, key) |
47 | 47 | iu.Export(d[key], img_name, bin=True) |
48 | - mask[key] = {'$imagedata': img_name} | |
48 | + mask[key] = {'$vti': img_name} | |
49 | 49 | else: |
50 | 50 | mask[key] = d[key] |
51 | 51 | ... | ... |
invesalius/data/surface.py
... | ... | @@ -50,7 +50,7 @@ class Surface(): |
50 | 50 | if isinstance(d[key], vtk.vtkPolyData): |
51 | 51 | img_name = '%s_%s.vtp' % (filename, key) |
52 | 52 | pu.Export(d[key], img_name, bin=True) |
53 | - surface[key] = {'$polydata': img_name} | |
53 | + surface[key] = {'$vtp': img_name} | |
54 | 54 | else: |
55 | 55 | surface[key] = d[key] |
56 | 56 | plistlib.writePlist(surface, filename + '.plist') | ... | ... |
invesalius/project.py
... | ... | @@ -138,26 +138,28 @@ class Project(object): |
138 | 138 | |
139 | 139 | for key in self.__dict__: |
140 | 140 | if getattr(self.__dict__[key], 'SavePlist', None): |
141 | - project[key] = {'path': self.__dict__[key].SavePlist(filename)} | |
141 | + project[key] = {'$plist': self.__dict__[key].SavePlist(filename)} | |
142 | 142 | else: |
143 | 143 | project[key] = self.__dict__[key] |
144 | 144 | |
145 | 145 | masks = {} |
146 | 146 | for index in self.mask_dict: |
147 | - masks[str(index)] = self.mask_dict[index].SavePlist(filename) | |
147 | + masks[str(index)] = {'#mask':\ | |
148 | + self.mask_dict[index].SavePlist(filename)} | |
148 | 149 | print index |
149 | 150 | |
150 | 151 | surfaces = {} |
151 | 152 | for index in self.surface_dict: |
152 | - surfaces[str(index)] = self.surface_dict[index].SavePlist(filename) | |
153 | + surfaces[str(index)] = {'#surface':\ | |
154 | + self.surface_dict[index].SavePlist(filename)} | |
153 | 155 | print index |
154 | 156 | |
155 | 157 | project['surface_dict'] = surfaces |
156 | 158 | project['mask_dict'] = masks |
157 | 159 | img_file = '%s_%s.vti' % (filename, 'imagedata') |
158 | 160 | iu.Export(self.imagedata, img_file, bin=True) |
159 | - project['imagedata'] = img_file | |
160 | - | |
161 | + project['imagedata'] = {'$vti':img_file} | |
162 | + print project | |
161 | 163 | plistlib.writePlist(project, filename + '.plist') |
162 | 164 | |
163 | 165 | Compress(dir_, "teste.inv3")#os.path.join("~/Desktop/","teste.inv3")) |
... | ... | @@ -173,7 +175,6 @@ class Project(object): |
173 | 175 | |
174 | 176 | for key in project: |
175 | 177 | setattr(self, key, project[key]) |
176 | - | |
177 | 178 | print "depois", self.__dict__ |
178 | 179 | #masks = project['masks'] |
179 | 180 | #for index in masks: | ... | ... |