<jupyter_start><jupyter_text>Segment a sparse 3D image with a single material component  The goal of this notebook is to develop a 3D segmentation algorithm that improves segmentation where features are detected.**Data:** AM parts from Xuan Zhang.<jupyter_code>%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import os
import h5py
import sys
import time
import seaborn as sns
import pandas as pd

from tomo_encoders import Patches
from params import model_path, get_model_params
from datasets import dataset_names, get_datasets
from tomo_encoders.rw_utils.data_pairs import load_dataset_pairs
from tomo_encoders.neural_nets.surface_segmenter import SurfaceSegmenter
from tomo_encoders.misc import viewer
from tomo_encoders import DataFile
from tomo_encoders.misc.img_stats import calc_jac_acc
datasets = get_datasets(dataset_names[:], test_binning = 1)
datasets
ds1 = DataFile('/data02/MyArchive/tomo_datasets/AM_part_Xuan/data/AM316_L205_fs_tomo_L5_rec_1x1_uint16_tiff', tiff = True)
ds2 = DataFile('/data02/MyArchive/tomo_datasets/AM_part_Xuan/data/mli_L206_HT_650_L3_rec_1x1_uint16_tiff', tiff = True)
img1 = ds1.read_slice(axis = 0, slice_idx = 450)
img2 = ds2.read_slice(axis = 0, slice_idx = 551)
plt.imshow(img1, cmap = 'gray')
plt.imshow(img2, cmap = 'gray')
ds1 = DataFile('/data02/MyArchive/tomo_datasets/AM_part_Xuan/seg_data/AM316_L205_fs_tomo_L5/AM316_L205_fs_tomo_L5_GT', tiff = True)
ds2 = DataFile('/data02/MyArchive/tomo_datasets/AM_part_Xuan/seg_data/mli_L206_HT_650_L3/mli_L206_HT_650_L3_GT', tiff = True)
plt.imshow(ds1.read_slice(axis = 0, slice_idx = 450), cmap = 'gray')
plt.imshow(ds2.read_slice(axis))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08164481525625746, 'fraction_numerical': 0.05125148986889154, 'mean_word_length': 7.230392156862745, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '255736', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 699, 'n_tokens_neox': 635, 'n_words': 137, 'path': 'scratchpad/voids_paper/notebooks/scratch/analysis_0_probe_data.ipynb', 'repo_name': 'arshadzahangirchowdhury/TomoEncoders', 'size': '1678'}