Skip to content

Commit a71b6a0

Browse files
committed
max voxels
1 parent 20d8777 commit a71b6a0

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ In **dcm2save.py** are 3 special configuration variables:
6565
minVal = 130
6666
maxVal = 134
6767
materialSwitch = 15
68+
maxVoxels = -1
6869

6970
**minVal** and **maxVal** are the raw gray values from the image, every value in between would be displayed later.
7071
You **HAVE** to play with those values to get an accurate result (later there will be a GUI for that....).
@@ -73,7 +74,10 @@ You **HAVE** to play with those values to get an accurate result (later there wi
7374
You may have to play with it too.
7475
The maximum value is 99.
7576

76-
All 3 have command line switches too.
77+
**maxVoxels** is the maximum number of voxels to be processed.
78+
If you have a large dataset, you can limit the number of voxels to be processed.
79+
80+
All have command line switches too.
7781

7882
```bash
7983
python dcm2save.py tmp/ savefile=bison_brain.sav minVal=10 maxVal=255 materialSwitch=10

dcm2save.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
minVal = 130 #12850
1111
maxVal = 136 #13000 #13366
1212
materialSwitch = 15
13+
maxVoxels = -1
1314

1415
# max len of material index we can use
1516
materialMatrixL = 99 #len(materialMatrix)
@@ -62,6 +63,8 @@ def getInt(name):
6263
materialSwitch = int(arg.replace("materialSwitch=", ""))
6364
elif arg.startswith("heightMap="):
6465
heightMap = bool(int(arg.replace("heightMap=", "")))
66+
elif arg.startswith("maxVoxels="):
67+
maxVoxels = int(arg.replace("maxVoxels=", ""))
6568

6669
if heightMap:
6770
sourceFiles.append(sys.argv[1])
@@ -376,6 +379,8 @@ def getFromPnm():
376379
countX += 1
377380
countZ += 1
378381
print("current voxel:", countVoxel)
382+
if maxVoxels != -1 and countVoxel >= maxVoxels:
383+
break
379384
#if countZ > 10:
380385
# break
381386
#finalStr += "\n"

engine.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,11 @@ def _initialize(self):
184184

185185
def force_show(self):
186186
# dirty hack to force rendering
187+
counter = 0
187188
for position, data in self.world.items():
188189
if self.exposed(position):
189190
self._show_block(position, data)
191+
counter += 1
190192

191193
def hit_test(self, position, vector, max_distance=8):
192194
""" Line of sight search from current position. If a block is

0 commit comments

Comments
 (0)