You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

多STEM信号写入多数据立方体:双信号采集存储实现问询

Multi-Signal STEM Acquisition: Separating HAADF/BF into Stacks with Progress Tracking

Great question! I’ve tackled this exact multi-signal STEM acquisition workflow before, so let me break down a reliable approach that hits all your requirements: no cluttering the screen with hundreds of images, simultaneous capture to separate stacks, and clear progress tracking.

Step 1: Preallocate Your Image Stacks

First, you’ll want to preallocate memory for your HAADF (stack1) and BF (stack2) stacks to avoid slow dynamic resizing. Use the current image dimensions from your microscope setup to match the signal size:

% Define acquisition parameters
num_frames = 100; % Number of frames in your sequence
[img_height, img_width] = DSGetImageSize(); % Grab current frame dimensions
haadf_signal_idx = 1; % Replace with your actual HAADF signal index
bf_signal_idx = 2; % Replace with your actual BF signal index

% Preallocate stacks (use uint16 for typical STEM signal depth)
stack1 = zeros([img_height, img_width, num_frames], 'uint16'); % HAADF stack
stack2 = zeros([img_height, img_width, num_frames], 'uint16'); % BF stack

Pro tip: Use DSListSignals() to list all available signals and confirm their indices if you’re unsure.

Step 2: Configure Digiscan for Multi-Signal, Headless Acquisition

To avoid screen clutter and enable simultaneous capture, tweak Digiscan’s core settings before starting acquisition:

% Configure Digiscan to capture both signals
digiscan.SignalsToAcquire = [haadf_signal_idx, bf_signal_idx];
% Disable real-time image display (critical for avoiding screen overload)
digiscan.DisplayImagesDuringAcquisition = false;
% Set to sequence acquisition mode
digiscan.AcquisitionMode = 'Sequence';

Step 3: Run Acquisition with Progress Tracking

Start the acquisition loop, pull both signals per frame, and write them to their respective stacks. Add progress updates to keep you informed without cluttering the screen:

Option 1: Text-Based Progress (Lightweight)

% Start the acquisition
DSStartAcquisition();

for frame_num = 1:num_frames
    % Pull both signal frames in one call
    [signal_data, ~] = DSAcquireData([haadf_signal_idx, bf_signal_idx]);
    
    % Write each signal to its stack
    stack1(:,:,frame_num) = signal_data(:,:,1);
    stack2(:,:,frame_num) = signal_data(:,:,2);
    
    % Print progress to the command window
    progress_pct = (frame_num / num_frames) * 100;
    fprintf('Acquired frame %d/%d (%.1f%% complete)\n', frame_num, num_frames, progress_pct);
end

% End the acquisition session
DSEndAcquisition();

Option 2: Visual Progress Bar (More Intuitive)

If you prefer a graphical progress tracker, use MATLAB’s waitbar:

% Initialize progress bar
progress_bar = waitbar(0, 'Starting STEM acquisition...');

DSStartAcquisition();

for frame_num = 1:num_frames
    [signal_data, ~] = DSAcquireData([haadf_signal_idx, bf_signal_idx]);
    
    stack1(:,:,frame_num) = signal_data(:,:,1);
    stack2(:,:,frame_num) = signal_data(:,:,2);
    
    % Update progress bar
    waitbar(frame_num / num_frames, progress_bar, ...
        sprintf('Acquired %d/%d frames', frame_num, num_frames));
end

DSEndAcquisition();
close(progress_bar); % Clean up the progress bar

Optional: Occasional Preview Frames

If you want to verify signal quality without spamming the screen, add a conditional preview (e.g., every 10 frames):

% Inside the acquisition loop:
if mod(frame_num, 10) == 0
    % Update a single HAADF preview figure
    figure(1); clf;
    imshow(stack1(:,:,frame_num), []);
    title(sprintf('HAADF Preview: Frame %d', frame_num));
    
    % Update a single BF preview figure
    figure(2); clf;
    imshow(stack2(:,:,frame_num), []);
    title(sprintf('BF Preview: Frame %d', frame_num));
    
    drawnow; % Force immediate figure update
end

Key Notes

  • Memory Management: If you’re capturing a huge number of frames, consider using disk-based arrays (e.g., matfile) to avoid hitting RAM limits.
  • Signal Index Validation: Always double-check signal indices with DSListSignals()—misindexing will lead to wrong data in your stacks.
  • Data Type Matching: Use the correct data type (e.g., uint16 for 12/16-bit STEM signals) to preserve dynamic range.

内容的提问来源于stack exchange,提问作者TomNorway

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 06:32:40