amaazetools 0.1.3__tar.gz → 0.1.4__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.
Files changed (26) hide show
  1. {amaazetools-0.1.3/amaazetools.egg-info → amaazetools-0.1.4}/PKG-INFO +2 -2
  2. {amaazetools-0.1.3 → amaazetools-0.1.4}/README.md +1 -1
  3. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools/trimesh.py +29 -45
  4. {amaazetools-0.1.3 → amaazetools-0.1.4/amaazetools.egg-info}/PKG-INFO +2 -2
  5. {amaazetools-0.1.3 → amaazetools-0.1.4}/pyproject.toml +1 -1
  6. {amaazetools-0.1.3 → amaazetools-0.1.4}/src/cextensions.c +2 -0
  7. {amaazetools-0.1.3 → amaazetools-0.1.4}/LICENSE +0 -0
  8. {amaazetools-0.1.3 → amaazetools-0.1.4}/MANIFEST.in +0 -0
  9. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools/__init__.py +0 -0
  10. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools/dicom.py +0 -0
  11. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools/edge_detection.py +0 -0
  12. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools/mesh_segmentation.py +0 -0
  13. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools/svi.py +0 -0
  14. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools.egg-info/SOURCES.txt +0 -0
  15. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools.egg-info/dependency_links.txt +0 -0
  16. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools.egg-info/requires.txt +0 -0
  17. {amaazetools-0.1.3 → amaazetools-0.1.4}/amaazetools.egg-info/top_level.txt +0 -0
  18. {amaazetools-0.1.3 → amaazetools-0.1.4}/setup.cfg +0 -0
  19. {amaazetools-0.1.3 → amaazetools-0.1.4}/setup.py +0 -0
  20. {amaazetools-0.1.3 → amaazetools-0.1.4}/src/memory_allocation.c +0 -0
  21. {amaazetools-0.1.3 → amaazetools-0.1.4}/src/memory_allocation.h +0 -0
  22. {amaazetools-0.1.3 → amaazetools-0.1.4}/src/mesh_operations.c +0 -0
  23. {amaazetools-0.1.3 → amaazetools-0.1.4}/src/mesh_operations.h +0 -0
  24. {amaazetools-0.1.3 → amaazetools-0.1.4}/src/svi_computations.c +0 -0
  25. {amaazetools-0.1.3 → amaazetools-0.1.4}/src/svi_computations.h +0 -0
  26. {amaazetools-0.1.3 → amaazetools-0.1.4}/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
3
+ Version: 0.1.4
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
@@ -50,7 +50,7 @@ Email <jwcalder@umn.edu> with any questions or comments.
50
50
 
51
51
  ## Contributors
52
52
 
53
- Several people have contributed to the development of this software:
53
+ Several people have contributed to the development of this software:
54
54
 
55
55
  1. David Floeder
56
56
  2. Riley O'Neill
@@ -26,7 +26,7 @@ Email <jwcalder@umn.edu> with any questions or comments.
26
26
 
27
27
  ## Contributors
28
28
 
29
- Several people have contributed to the development of this software:
29
+ Several people have contributed to the development of this software:
30
30
 
31
31
  1. David Floeder
32
32
  2. Riley O'Neill
@@ -10,6 +10,7 @@ from plyfile import PlyData, PlyElement
10
10
  import scipy.sparse as sparse
11
11
  import scipy.spatial as spatial
12
12
  from skimage import measure
13
+ from skimage.color import convert_colorspace
13
14
  from sklearn.neighbors import NearestNeighbors
14
15
  from . import svi
15
16
  from . import edge_detection
@@ -653,13 +654,18 @@ class mesh:
653
654
  return mesh
654
655
 
655
656
  #Write a ply file
656
- def to_ply(self,fname):
657
+ def to_ply(self,fname,c=None):
657
658
  """ Writes the mesh to a .ply file.
658
659
 
659
660
  Parameters
660
661
  ----------
661
662
  fname : str
662
663
  The name of the .ply file to write the mesh to.
664
+ c : numpy array
665
+ Color array. If provided, then color is added to ply file.
666
+ If array is num_vert x 3, it is interprted as RGB colors
667
+ in the range 0,...,255. If the array is one dimensional
668
+ of length num_vert, then the values are interpreted as hues.
663
669
  """
664
670
 
665
671
  f = open(fname,"w")
@@ -671,6 +677,11 @@ class mesh:
671
677
  f.write('property double x\n')
672
678
  f.write('property double y\n')
673
679
  f.write('property double z\n')
680
+ #Write color header if colors are provided
681
+ if c is not None:
682
+ f.write('property uchar red\n')
683
+ f.write('property uchar green\n')
684
+ f.write('property uchar blue\n')
674
685
  f.write('element face %u\n'%self.num_tri())
675
686
  f.write('property list int int vertex_indices\n')
676
687
  f.write('end_header\n')
@@ -678,8 +689,23 @@ class mesh:
678
689
 
679
690
  f = open(fname,"ab")
680
691
 
681
- #write vertices
682
- f.write(self.points.astype('float64').tobytes())
692
+ #If no colors are provided
693
+ if c is None:
694
+ #write vertices
695
+ f.write(self.points.astype('float64').tobytes())
696
+ #If colors are provided
697
+ else:
698
+ #If scalars provided, then convert from hue to rgb
699
+ if c.ndim == 1:
700
+ c = c - np.min(c)
701
+ c = c/np.max(c)
702
+ arr = np.vstack((c,np.ones_like(c),np.ones_like(c))).T
703
+ c = 255*convert_colorspace(arr,'HSV','RGB')
704
+
705
+ #write vertices
706
+ for i in range(self.num_verts()):
707
+ f.write(self.points[i,:].astype('float64').tobytes())
708
+ f.write(c[i,:].astype('uint8').tobytes())
683
709
 
684
710
  #write faces
685
711
  T = np.hstack((np.ones((self.num_tri(),1))*3,self.triangles)).astype(int)
@@ -688,48 +714,6 @@ class mesh:
688
714
  #close file
689
715
  f.close()
690
716
 
691
- #Write a ply file
692
- def write_color_ply(self,color,fname):
693
- """ Writes the colored mesh to a .ply file.
694
-
695
- Parameters
696
- ----------
697
- color : (num,verts,3) float array
698
- An array of color data for each point.
699
- fname : str
700
- The name of the .ply file to write the colored mesh to.
701
- """
702
-
703
- f = open(fname,"w")
704
-
705
- #Write header
706
- f.write('ply\n')
707
- f.write('format binary_little_endian 1.0\n')
708
- f.write('element vertex %u\n'%self.num_verts())
709
- f.write('property double x\n')
710
- f.write('property double y\n')
711
- f.write('property double z\n')
712
- f.write('property uchar red\n')
713
- f.write('property uchar green\n')
714
- f.write('property uchar blue\n')
715
- f.write('element face %u\n'%self.num_tri())
716
- f.write('property list int int vertex_indices\n')
717
- f.write('end_header\n')
718
- f.close()
719
-
720
- f = open(fname,"ab")
721
-
722
- #write vertices
723
- for i in range(self.num_verts()):
724
- f.write(P[i,:].astype('float64').tobytes())
725
- f.write(color[i,:].astype('uint8').tobytes())
726
-
727
- #write faces
728
- T = np.hstack((np.ones((self.num_tri(),1))*3,T)).astype(int)
729
- f.write(T.astype('int32').tobytes())
730
-
731
- #close file
732
- f.close()
733
717
 
734
718
  def to_gif(self,fname,color = [],duration=7,fps=20,size=750,histeq = True):
735
719
  """ Writes rotating gif
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: amaazetools
3
- Version: 0.1.3
3
+ Version: 0.1.4
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
@@ -50,7 +50,7 @@ Email <jwcalder@umn.edu> with any questions or comments.
50
50
 
51
51
  ## Contributors
52
52
 
53
- Several people have contributed to the development of this software:
53
+ Several people have contributed to the development of this software:
54
54
 
55
55
  1. David Floeder
56
56
  2. Riley O'Neill
@@ -9,7 +9,7 @@ packages = ['amaazetools']
9
9
 
10
10
  [project]
11
11
  name = "amaazetools"
12
- version = "0.1.3"
12
+ version = "0.1.4"
13
13
  authors = [
14
14
  { name="Jeff Calder", email="jwcalder@umn.edu" },
15
15
  ]
@@ -2,6 +2,8 @@
2
2
  *
3
3
  */
4
4
 
5
+
6
+
5
7
  #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
6
8
 
7
9
  #include <Python.h>
File without changes
File without changes
File without changes
File without changes