Slicer3:LUTs and Ontologies:Renumber Script

From Slicer Wiki
Revision as of 14:28, 10 June 2010 by Pieper (talk | contribs) (Created page with 'Edit as needed to renumber wiki tables of slicer colors: <pre> set fpin [open "~/tmp/colors.wiki"] set fpout [open "~/tmp/colors2.wiki" "w"] set index 0 while { ![eof $fpin] } …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Slicer3:LUTs and Ontologies:Renumber Script

Edit as needed to renumber wiki tables of slicer colors:

set fpin [open "~/tmp/colors.wiki"]
set fpout [open "~/tmp/colors2.wiki" "w"]

set index 0
while { ![eof $fpin] } {
  set line [gets $fpin]
  if { [scan $line "|%d" oldindex] != 1 } {
    puts $fpout $line
  } else {
    puts $fpout "|$index"
    incr index
  }
}

close $fpin
close $fpout