A neural network approach to medical image segmentation and Three-Dimensional Reconstruction