#NEWLINE# def addVoxels( p , f ) : #NEWLINE# #INDENT# 'Add a cube of data to the HDF5 file as a list of voxels' #NEWLINE# h5f = h5py . File ( f . name ) #NEWLINE# ( xlow , xhigh , ylow , yhigh , zlow , zhigh ) = p . args #NEWLINE# voxlist = [ ] #NEWLINE# for k in range ( zlow , zhigh ) : #NEWLINE# #INDENT# for j in range ( ylow , yhigh ) : #NEWLINE# #INDENT# for i in range ( xlow , xhigh ) : #NEWLINE# #INDENT# voxlist . append ( [ i , j , k ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# idgrp = h5f [ str ( yhigh . annoid ) ] #NEWLINE# if ( not isinstance ( p . annoid , int ) ) : #NEWLINE# #INDENT# p . annoid = 0 #NEWLINE# #UNINDENT# idgrp . create_dataset ( 'ANNOTATION_ID' , ( 1 , ) , np . uint32 , data = p . annoid ) #NEWLINE# idgrp . create_dataset ( 'RESOLUTION' , ( 1 , ) , np . uint32 , data = p . resolution ) #NEWLINE# idgrp . create_dataset ( 'VOXELS' , ( len ( voxlist ) , 3 ) , np . uint32 , data = voxlist ) #NEWLINE# h5f . flush ( )