Package for surface extraction using Linear Algebraic Representation theory by Alberto Paoluzzi. See original Julia repository for more details.
] add https://github.com/mjirik/LarSurf.jl
The package is prepared for pure Julia however for reading various file formats and the visualization we use additional packages.
To read the
Computed Tomography
data in DICOM
and other formats we use Pio3d.jl package. This package is wrapper for python io3d
.
Install python packages with conda
conda install -c simpleitk -c mjirik -c conda-forge io3d simpleitk pandas
Run Julia and install wrappers for python packages:
ENV["PYTHON"] = strip(split(read(`$((Sys.iswindows() ? "where" : "which")) python`, String), "\n")[1])
using Pkg; Pkg.add("PyCall") ; Pkg.build("PyCall")
] add Pandas
] add https://github.com/mjirik/Pio3d.jl
using Pandas, Pio3d
ViewerGL
can be used to perform the visualization.
] add http://github.com/cvdlab/LinearAlgebraicRepresentation.jl#julia-1.0
] add http://github.com/cvdlab/ViewerGL.jl
There might be some problems with DataStructures package version or with the Triangle build.
] develop https://github.com/mjirik/LarSurf.jl
Do the surface extraction on simple shape. Source code
using ViewerGL
using Distributed
addprocs(3)
using LarSurf
block_size = [20, 20, 20]
LarSurf.lsp_setup(block_size)
segmentation = LarSurf.generate_truncated_sphere(10)
V, FV = LarSurf.lsp_get_surface(segmentation)
FVtri = LarSurf.triangulate_quads(FV)
Vs = LarSurf.Smoothing.smoothing_FV_taubin(V, FV, 0.4, -0.3, 50)
ViewerGL.VIEW([
ViewerGL.GLGrid(Vs,FVtri,ViewerGL.Point4d(1,1,1,0.1))
ViewerGL.GLAxis(ViewerGL.Point3d(-1,-1,-1),ViewerGL.Point3d(1,1,1))
])
objlines = LarSurf.Lar.lar2obj(Vs, FVtri, "tetris_tri_taubin.obj")
Do the surface extraction on simple shape. Source code
using ViewerGL
using Distributed
if nprocs() == 1
addprocs(3)
@info "adding 3 more CPUs"
end
using Logging
using SparseArrays
@everywhere using LarSurf
block_size = [2, 2, 2]
segmentation = LarSurf.tetris_brick()
LarSurf.lsp_setup(block_size)
larmodel = LarSurf.lsp_get_surface(segmentation)
V, FV = larmodel
FVtri = LarSurf.triangulate_quads(FV)
objlines = LarSurf.Lar.lar2obj(V, FVtri, "tetris_tri.obj")
ViewerGL.VIEW([
ViewerGL.GLGrid(V,FVtri,ViewerGL.Point4d(1,1,1,0.1))
ViewerGL.GLAxis(ViewerGL.Point3d(-1,-1,-1),ViewerGL.Point3d(1,1,1))
])
Vs = LarSurf.Smoothing.smoothing_FV_taubin(V, FV, 0.4, -0.2, 2)
ViewerGL.VIEW([
ViewerGL.GLGrid(Vs,FVtri,ViewerGL.Point4d(1,1,1,0.1))
ViewerGL.GLAxis(ViewerGL.Point3d(-1,-1,-1),ViewerGL.Point3d(1,1,1))
])
objlines = LarSurf.Lar.lar2obj(V, FVtri, "tetris_tri_taubin.obj")
Run experiment with corrosion cast data. Measure all statistics.
Data can be downloaded here
julia experiments\surface_extraction_parallel.jl --crop 50 -i nrn10.jld2 --show
To have more information about options use
julia experiments\surface_extraction_parallel.jl --help
Data can be downloaded here
julia experiments\surface_extraction_parallel.jl --crop 100 -i nrn10.pklz --show
Run experiment with extraction of CT data. Measure all statistics.
We are using dataset 3D-IRCADb 01 | IRCAD France.
using Pio3d
Pio3d.datasets_download("3Dircadb1.1")
datap = Pio3d.read3d(Pio3d.datasets_join_path("medical/orig/sample-data/nrn4.pklz"))
Data can be also manually downloaded from dataset website
Due to long run time the experiment is divided into smaller parts.
The extracted data are stored into .jld2
files.
- Surface extraction
The
stepxy
andstepz
allow to drop some data for faster debug. Theblocks_size
parameter control the size of parallel blocks. - Smoothing
- Show extraction
- Create
.obj
file
All measured times are recorded into .csv
file
(exp_surface_extraction_ircad_times.csv
)
julia experiments\surface_extraction_parallel.jl -d medical/orig/3Dircadb1.1/MASKS_DICOM/portalvein --show --taubin_n 10 --taubin_lambda 0.5 --taubin_mu -0.2 --n_procs 4 --threshold 0 --color 1. 1. 0. 1.0
julia experiments\to_jld2.jl -i "..\..\..\lisa_data\nrn10.pklz"
Problems with install are often caused by PyCall package heck the python path
which python
There can be some problem with DataStructures
package version. It is
caused by ViewerGl
. It require DataStructures
with version 0.15.0
only.
You will probably need to remove JLD2
package and then install DataStructures
again.
] remove ExSup
] remove JLD2
] remove DataStructures
] add DataStructures@0.15.0
] add ExSup
On windows you will need
Windows SDK.
Then you need to start julia in x64 Native Tools Command Prompt for VS 2017
and
build the package.
] add Triangle
] build Triangle
Then you can start julia from cmd
.