amaazetools 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {amaazetools-0.1.0/amaazetools.egg-info → amaazetools-0.1.2}/PKG-INFO +2 -2
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools/dicom.py +73 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2/amaazetools.egg-info}/PKG-INFO +2 -2
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools.egg-info/requires.txt +1 -1
- {amaazetools-0.1.0 → amaazetools-0.1.2}/pyproject.toml +2 -2
- {amaazetools-0.1.0 → amaazetools-0.1.2}/LICENSE +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/MANIFEST.in +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/README.md +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools/__init__.py +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools/edge_detection.py +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools/mesh_segmentation.py +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools/svi.py +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools/trimesh.py +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools.egg-info/SOURCES.txt +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools.egg-info/dependency_links.txt +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/amaazetools.egg-info/top_level.txt +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/setup.cfg +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/setup.py +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/src/cextensions.c +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/src/memory_allocation.c +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/src/memory_allocation.h +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/src/mesh_operations.c +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/src/mesh_operations.h +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/src/svi_computations.c +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/src/svi_computations.h +0 -0
- {amaazetools-0.1.0 → amaazetools-0.1.2}/src/vector_operations.h +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: amaazetools
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Python package for mesh processing tools developed by AMAAZE
|
|
5
5
|
Author-email: Jeff Calder <jwcalder@umn.edu>
|
|
6
6
|
License: MIT
|
|
@@ -17,7 +17,7 @@ Requires-Dist: scipy
|
|
|
17
17
|
Requires-Dist: pandas
|
|
18
18
|
Requires-Dist: pydicom
|
|
19
19
|
Requires-Dist: scikit-image
|
|
20
|
-
Requires-Dist:
|
|
20
|
+
Requires-Dist: scikit-learn
|
|
21
21
|
Requires-Dist: matplotlib
|
|
22
22
|
Requires-Dist: graphlearning
|
|
23
23
|
Requires-Dist: plyfile
|
|
@@ -869,3 +869,76 @@ def seg_adjacency_matrix(u):
|
|
|
869
869
|
|
|
870
870
|
return M,X,Y
|
|
871
871
|
|
|
872
|
+
|
|
873
|
+
def surfacing_subproc(filename,directory,iso_level,write_gif=False):
|
|
874
|
+
|
|
875
|
+
print('Loading '+filename+'...')
|
|
876
|
+
M = np.load(os.path.join(directory,filename))
|
|
877
|
+
I = M['I']; dx = M['dx']; dz = M['dz']
|
|
878
|
+
|
|
879
|
+
#Rescale image to account for different dx/dz dimensions
|
|
880
|
+
J = rescale(I.astype(float),(dz/dx,1,1),mode='constant')
|
|
881
|
+
|
|
882
|
+
try:
|
|
883
|
+
verts,faces,normals,values = measure.marching_cubes(J,iso_level)
|
|
884
|
+
mesh = tm.mesh(dx*verts,faces) #Multiplication by dx fixes units
|
|
885
|
+
|
|
886
|
+
#Reverse orientation of triangles (marching_cubes returns inward normals)
|
|
887
|
+
mesh.flip_normals()
|
|
888
|
+
|
|
889
|
+
#Write to ply file
|
|
890
|
+
mesh_filename = os.path.join(directory,filename[:-4]+'_iso%d'%iso_level)
|
|
891
|
+
print('Saving mesh to '+mesh_filename+'...')
|
|
892
|
+
mesh.to_ply(mesh_filename+'.ply')
|
|
893
|
+
|
|
894
|
+
if write_gif:
|
|
895
|
+
mesh.to_gif(mesh_filename+'.gif')
|
|
896
|
+
return '0'
|
|
897
|
+
except Exception as error:
|
|
898
|
+
print('surfacing error with ', filename, ': ', error)
|
|
899
|
+
return filename
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
def surface_bones_parallel(directory, iso=2500, write_gif=False,error_fname='./surfacing_errors.csv',ncores='all'):
|
|
904
|
+
""" parallelized implementation of surface_bones with also surfacing error support.
|
|
905
|
+
Processes all npz files in directory creating surface and saving to a ply file.
|
|
906
|
+
|
|
907
|
+
Parameters
|
|
908
|
+
----------
|
|
909
|
+
directory : str
|
|
910
|
+
Directory to work within.
|
|
911
|
+
iso : float (optional), default is 2500
|
|
912
|
+
Iso level to be used for surfacing.
|
|
913
|
+
write_gif : bool (optional), default=False
|
|
914
|
+
Whether to output rotating gifs for each object. Requires mayavi, which can be hard to install.
|
|
915
|
+
error_fname
|
|
916
|
+
|
|
917
|
+
Returns
|
|
918
|
+
-------
|
|
919
|
+
None
|
|
920
|
+
"""
|
|
921
|
+
|
|
922
|
+
ddd = os.listdir(directory)
|
|
923
|
+
|
|
924
|
+
fnames = []
|
|
925
|
+
for f in ddd:
|
|
926
|
+
if f.endswith('.npz'):
|
|
927
|
+
fnames.append(f)
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
if isinstance(ncores,int):
|
|
931
|
+
num_cores = ncores
|
|
932
|
+
else:
|
|
933
|
+
num_cores =multiprocessing.cpu_count()
|
|
934
|
+
|
|
935
|
+
errs = Parallel(n_jobs=num_cores)(delayed(surfacing_subproc)(f,directory,iso,write_gif) for f in fnames)
|
|
936
|
+
|
|
937
|
+
errs = np.array(errs)
|
|
938
|
+
errs = errs[errs!='0']
|
|
939
|
+
|
|
940
|
+
if len(errs)==0:
|
|
941
|
+
print('no errors, not saving an error csv.')
|
|
942
|
+
else:
|
|
943
|
+
print('there were ' + str(len(errs)) +' errors. saving CSV to ',error_fname)
|
|
944
|
+
pd.DataFrame(errs).to_csv(error_fname,header=False, index=False)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: amaazetools
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Python package for mesh processing tools developed by AMAAZE
|
|
5
5
|
Author-email: Jeff Calder <jwcalder@umn.edu>
|
|
6
6
|
License: MIT
|
|
@@ -17,7 +17,7 @@ Requires-Dist: scipy
|
|
|
17
17
|
Requires-Dist: pandas
|
|
18
18
|
Requires-Dist: pydicom
|
|
19
19
|
Requires-Dist: scikit-image
|
|
20
|
-
Requires-Dist:
|
|
20
|
+
Requires-Dist: scikit-learn
|
|
21
21
|
Requires-Dist: matplotlib
|
|
22
22
|
Requires-Dist: graphlearning
|
|
23
23
|
Requires-Dist: plyfile
|
|
@@ -9,7 +9,7 @@ packages = ['amaazetools']
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "amaazetools"
|
|
12
|
-
version = "0.1.
|
|
12
|
+
version = "0.1.2"
|
|
13
13
|
authors = [
|
|
14
14
|
{ name="Jeff Calder", email="jwcalder@umn.edu" },
|
|
15
15
|
]
|
|
@@ -27,7 +27,7 @@ dependencies = ['numpy',
|
|
|
27
27
|
'pandas',
|
|
28
28
|
'pydicom',
|
|
29
29
|
'scikit-image',
|
|
30
|
-
'
|
|
30
|
+
'scikit-learn',
|
|
31
31
|
'matplotlib',
|
|
32
32
|
'graphlearning',
|
|
33
33
|
'plyfile'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|