I/O and History Tracking¶
- notebooks/io/io_create_dataset.ipynb
Builds a JuSPICE dataset from a folder of real image frames, then turns it into a single number-per-frame time series — with a
Trackerandrecording_start()/recording_stop()blocks capturing the code used throughout. The 73 in-situ TEM frames inSample_data/Train_test_images/SiO2_lithiation/images/trainload as one ordereddataset_type='multiple_frames'SPICEDataviaload_frame_sequence(). A loop then runs marker-based watershed segmentation (spice.clustering.watershed_clustering()) on every frame, counts how many clusters each frame has, and stores that count-per-frame series in a newSPICEData— which gets plotted and saved, along with a session-level history script and per-dataset reproducibility files (.npy,.json,_history.py). Covers JuSPICE’s two-track history system: literal code capture viaTracker, and structured operation recording viaDatasetHistory.- notebooks/io/io_afm1.ipynb
Loads a Bruker AFM
.spmscan withload_data(), which stacks every channel on the shared pixel grid into one(height, width, n_channels)SPICEData.dataarray, with channel names inspice.metadata['channel_names']. Shows all channels, levels theHeight Sensorchannel with pySPM’s own.correct_plane()(the rawpySPM.SPM_imageobjects stay available inspice.extra['channels']), then pulls out one channel and runs it through the standardspice.preprocess.<method>()interface to confirm it works just like any other image. Finally extracts five feature maps (Gaussian smoothing, Sobel edge strength, Frangi ridge/vessel detection, local Shannon entropy, and structure-tensor coherence) withspice.features.extract()and saves the resulting(H, W, 5)feature stack.- notebooks/io/io_afm2.ipynb
Builds on
io_afm1.ipynb: reshapes the multi-channel AFM array into an(n_pixels, n_channels)table, estimates a good cluster count with the elbow method (usingsklearn.cluster.KMeansdirectly, just to explore), then clusters the per-pixel feature vectors for real withspice.clustering.kmeans_clustering()— the same clustering accessor used elsewhere in JuSPICE for watershed, SLIC, Felzenszwalb, Otsu, and Quickshift. Unlike those,kmeans_clustering()clusters the raw per-pixel vectors rather than one grayscale image, so every AFM channel contributes to the result. The call automatically creates a newSPICEDatathat shares the original object’s history, then saves it.- notebooks/io/io_dm3.ipynb
Loads a Gatan DigitalMicrograph
.dm3TEM image withload_data(), and checks the real-world pixel spacing stored inspice.metadata. Runs it throughspice.preprocess.normalize()andspice.features.extract(feature_names='sobel_magnitude')— the same accessors used for ordinary PNG/TIFF images — to confirm they work the same way here too.- notebooks/io/io_ser.ipynb
Loads an FEI/TIA
.serSTEM image withload_data(), checking the pixel spacing and the full list of acquisition settings (accelerating voltage, magnification, stage position, and more) stored inspice.metadata['acquisition']. Runs it throughspice.preprocess.normalize()to confirm interoperability.- notebooks/io/io_emi.ipynb
Loads an FEI/TIA
.emiproject file withload_data(). Unlike.dm3/.serfiles, an.emifile just holds metadata and points to a companion.serfile stored next to it; the loader finds that companion file automatically and reports how many image series it found inspice.metadata['n_series']. Runs the image throughspice.preprocess.normalize()to confirm interoperability.