Skip to content

Commit

Permalink
add fixedval for coloring method
Browse files Browse the repository at this point in the history
  • Loading branch information
DaisukeMiyamoto committed Aug 30, 2017
1 parent 705dd22 commit 7d90cf1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions swc2vtk/vtkgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,16 @@ def _type2text(self):

return text

def _coloringbyswc(self):
def _coloringbyswc(self, fixedval):
text = ''
text += 'SCALARS coloring float 1\n'
text += 'LOOKUP_TABLE default\n'

if fixedval is None:
fixedval = 0.0

for i, swc in enumerate(self.swc_list):
val = i * (1.0 / len(self.swc_list))
val = fixedval + i * (1.0 / len(self.swc_list))
for j in range(len(swc.data) - 1):
for k in range(self.ncell_per_compartment):
text += str(val + (1.0 / len(self.swc_list) / (len(swc.data) - 1))) + '\n'
Expand Down Expand Up @@ -351,7 +354,7 @@ def write_vtk(self, filename, fixedval=None, datatitle='filedata', movingval=Fal
file.write(self._file2text(self.datafile_list, datatitle))

if coloring:
file.write(self._coloringbyswc())
file.write(self._coloringbyswc(fixedval))

if radius_data:
file.write(self._radius2text())
Expand Down

0 comments on commit 7d90cf1

Please sign in to comment.