//Load bone mask private void maskButton_Click(object sender, EventArgs e) { label4.Text = "Loading: "; mainProgress.Value = 10; //Dwitch between loading and removing the bone mask switch (is_mask) { case 0: //Check if volume is rendered if (is_rendering == 1) { //Select a file if (fileDialog.ShowDialog() == DialogResult.OK) { //Get path and files string impath = fileDialog.FileName; string extension = Path.GetExtension(@impath); string folpath = Path.GetDirectoryName(@impath); maskLabel.Text = folpath; //Load image data volume.connectMask(impath); //Update pipeline volume.updateCurrent(sliceN, ori, gray); // Set cartilage grids based on mask //volume.SampleGrids(); mainProgress.Value = 50; //Render if (ori == -1) { volume.renderVolumeMask(); volume.setVolumeColor(); } if (ori > -1) { volume.renderImageMask(); } //Update flags is_mask = 1; maskButton.Text = "Remove Mask"; } } break; case 1: volume.removeMask(); volume.updateCurrent(sliceN, ori, gray); if (ori == -1) { volume.renderVolume(); TellSlice(); } if (ori > -1) { volume.renderImage(); TellSlice(); } is_mask = 0; maskButton.Text = "Load Mask"; maskLabel.Text = "No Mask Loaded"; break; } GC.Collect(); // Update tooltip tip = "Loaded mask. If calcified zone mask was used, deep and surface zones can be extracted."; gradeLabel.Text = tip; mainProgress.Value = 100; label4.Text = "Done"; }