<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 <NAME>.<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 tomo_encoders.misc import viewer
from tomo_encoders import DataFile
import cupy as cp
from tomo_encoders.reconstruction.project import get_projections
from tomo_encoders.reconstruction.recon import recon_binning
from tomo_encoders.misc.voxel_processing import cylindrical_mask, normalize_volume_gpu
ds1 = DataFile('/data02/MyArchive/aisteer_3Dencoders/tmp_data/train_y', tiff = True)
plt.imshow(ds1.read_slice(axis = 0, slice_idx = 384), cmap = 'gray')
ds1 = DataFile('/data02/MyArchive/aisteer_3Dencoders/tmp_data/train_x', tiff = True)
tmp_img = ds1.read_slice(axis = 0, slice_idx = 384)
plt.imshow(tmp_img, cmap = 'gray')
print(f'min {tmp_img.min()}; max {tmp_img.max()}')
h = plt.hist(tmp_img.reshape(-1), bins = 500)
ds1 = DataFile('/data02/MyArchive/aisteer_3Dencoders/tmp_data/train_x_rec', tiff = True)
tmp_img = ds1.read_slice(axis = 0, slice_idx = 384)
plt.imshow(tmp_img, cmap = 'gray')
print(f'min {tmp_img.min()}; max {tmp_img.max()}')
h = plt.hist(tmp_img.reshape(-1), bins = 500)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10554803788903924, 'fraction_numerical': 0.02571041948579161, 'mean_word_length': 6.358208955223881, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '666538', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 570, 'n_tokens_neox': 532, 'n_words': 137, 'path': 'scratchpad/voids_paper/notebooks/scratch/check_training_pairs.ipynb', 'repo_name': 'arshadzahangirchowdhury/TomoEncoders', 'size': '1482'}