<jupyter_start><jupyter_text>Get 3D data<jupyter_code>datap = imtools.sample_data.generate()
data3d = datap["data3d"]
segmentation = datap["segmentation"]

print(data3d.shape, data3d.dtype)<jupyter_output>(100, 100, 100) int64<jupyter_text>Show every 20th slice<jupyter_code>sed3.show_slices(data3d, slice_step=20)<jupyter_output><empty_output><jupyter_text>One slice<jupyter_code>plt.imshow(data3d[30,:,:])<jupyter_output><empty_output><jupyter_text>Manual crop<jupyter_code>crinfo = [[10, 56], [14, 64], [39, 78]]
data3d_cropped = imma.crop(data3d, crinfo)

print(data3d.shape, data3d.dtype)
#sed3.show_slices(data3d_cropped, slice_step=20)
plt.imshow(data3d_cropped[30,:,:])<jupyter_output>(100, 100, 100) int64<jupyter_text>Get crinfo from labeled image<jupyter_code>plt.imshow(segmentation[30,:,:])
crinfo_auto = imma.crinfo_from_specific_data(segmentation, 5)
crinfo_auto
crinfo_auto = imma.crinfo_from_specific_data(segmentation, [5])
crinfo_auto
crinfo_auto = imma.crinfo_from_specific_data(segmentation, [5, 5, 5])
crinfo_auto
data3d_cropped_auto = imma.crop(data3d, crinfo_auto)
plt.imshow(data3d_cropped_auto[30,:,:])<jupyter_output><empty_output><jupyter_text>Uncrop data<jupyter_code>data3d_uncropped = imma.uncrop(
    data3d_cropped_auto, 
    crinfo_auto, 
    [100, 100, 100])
plt.imshow(data3d_uncropped[30,:,:])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13970588235294118, 'fraction_numerical': 0.0625, 'mean_word_length': 11.26126126126126, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '262389', 'license': 'MIT', 'n_tokens_mistral': 653, 'n_tokens_neox': 597, 'n_words': 66, 'path': 'examples/crop.ipynb', 'repo_name': 'mjirik/imtools', 'size': '1360'}