Logo Matlab Process Large Images

Matlab Process Large Images

Tổ chứcPhổ biến
matlab
matlab-process-large-images

Patterns for using blockedImage to process large images, harness parallel compute for image processing, and write custom adapters. Use when writing code that creates, processes, or visualizes blockedImage objects, when implementing images.blocked.Adapter subclasses, or when a user needs help with large image data. Always use this skill when working with TIFF,GeoTIFF, .svs, .ndpi, .czi or other WSI, satellite imagery or microscopy volume image formats.

Tổng quan

Nhà phát hànhmatlab
Kho mãmatlab-agentic-toolkit
Tên kỹ năngmatlab-process-large-images
Sao
1.2K
Bản fork
138
Tệp đi kèm
8
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 8 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được matlab công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Matlab Process Large Images trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/image-processing-and-computer-vision/matlab-process-large-images
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matlab/matlab-agentic-toolkit.git /tmp/matlab-agentic-toolkit
mkdir -p .claude/skills
cp -r /tmp/matlab-agentic-toolkit/skills-catalog/image-processing-and-computer-vision/matlab-process-large-images .claude/skills/matlab-process-large-images
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Matlab Process Large Images trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Matlab Process Large Images ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Matlab Process Large Images với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

When to Use

  • Writing code that creates, processes, or visualizes blockedImage objects
  • Implementing images.blocked.Adapter subclasses for custom file formats
  • User needs help with large image data that doesn't fit in memory
  • User wants to leverage parallel computing for image processing tasks
  • Working with whole-slide images, geospatial rasters, 3D microscopy volumes, or tiled mosaics
  • Any time a user is working with a TIFF file — load this skill and check the file first with imfinfo. Use blockedImage if the file is large (dimensions > 10,000 pixels in any axis), has multiple channels beyond RGB, or contains multiple IFDs (could be pyramid levels, time series, or Z-stack slices)

When NOT to Use

  • Image fits comfortably in memory and no parallel processing is needed — use standard imread/imwrite workflows
  • General image display without blockedImage — use the matlab-display-image skill instead
  • Deep learning model architecture or training loop design — this skill covers data preparation with blockedImageDatastore, not network design

Large Image Processing with blockedImage

Reference files (read on demand when the topic comes up):

  • references/visualization.md — imageshow, overlays, synced views, overview+detail, annotations
  • references/training-and-labeling.md — Image Labeler, labeled blockedImages, training datastores, DL inference
  • references/3d-volumes.md — 3D blocked images, 3D inference, 3D training data
  • references/geospatial.md — GeoTIFF, shapefiles, coordinate systems, spatial referencing
  • references/data-discovery.md — 7-step data discovery workflow, custom adapters, format conversion adapter selection, virtual composite adapters, adapter performance tips
  • references/specialized-workflows.md — writing block-by-block, coordinate systems, mask-based block selection, ExtraImages for pixel-level masking, in-place resume
  • references/whole-slide-images.md — importing WSI files via OpenSlide/Bio-Formats, choosing between libraries, display, downstream processing (segmentation, classification)

When to use blockedImage

blockedImage is not only for data that exceeds RAM. Even when the data fits in memory, wrapping it as a blockedImage lets you harness a parallel cluster: each worker can independently read and write different blocks, enabling parallel partial reads and parallel writes into separate file blocks.

Always ask the user what their intent with the data is. Ask about visualization, processing, DL training, archival, and whether they want to leverage parallel compute — even if the data fits in RAM.

When the user points you at a directory or multi-file dataset

ALWAYS read references/data-discovery.md and follow its 7-step workflow before writing any code. The workflow covers: inspecting file layout, parsing naming conventions, understanding user intent, choosing between single blockedImage vs. collection, assessing random access capabilities, checking for gaps/overlaps, and recommending an approach (built-in adapter, format conversion, or custom adapter).

Construction

matlab
% Read-only (auto-selects adapter; reads only metadata, fast)
bim = blockedImage("large_image.tif");

% Multiple images at once
[bim1, bim2] = blockedImage(["img1.tif", "img2.tif"]);

% Writable
bim = blockedImage(dest, imageSize, blockSize, initVal, Mode="w");

% Override adapter
bim = blockedImage(source, Adapter=myAdapter);

BlockSize

  • Defaults to a factor of IOBlockSize (adapter's native read unit), targeting ~1024 or the minimum dimension size.
  • The object's BlockSize is the default for all downstream processing and visualization.
  • Override per-operation via the BlockSize name-value argument (e.g., when a DL network requires a fixed input size).
  • For best performance, keep BlockSize as a multiple of IOBlockSize and as large as practical.

Reading Data

  • getBlock(bim, blocksub) — read one block by block subscript. Returns [data, blockinfo].
  • getRegion(bim, pixelStart, pixelEnd) — read an arbitrary pixel region.
  • gather(bim) — load entire image into memory (only if it fits in RAM). Use Level to select resolution.

Processing with apply()

apply(bim, @fcn) calls fcn on each block one at a time. Scales to arbitrarily large data. Supports UseParallel=true for cluster execution.

Key name-value arguments: BlockSize, BorderSize, Level, ExtraImages, PadPartialBlocks, PadMethod, OutputLocation, BatchSize, Resume, BlockLocationSet, DisplayWaitbar.

Block struct (bs) fields

The user function receives a block struct bs with:

  • bs.Data — pixel data for this block (includes border if BorderSize > 0)
  • bs.Start — 1-by-N pixel subscript of the block's top-left corner (excluding border)
  • bs.End — 1-by-N pixel subscript of the block's bottom-right corner (excluding border)
  • bs.BorderSize — 1-by-N border size used
  • bs.Level — resolution level
  • bs.BlockSub — block subscript (index into SizeInBlocks)
  • bs.ImageNumber — index of the source image (when processing an array)

Struct / non-image output

When the output per block is not image data (e.g., detection results, counts), use images.blocked.MATBlocks adapter to store structs:

matlab
bResults = apply(bim, @countNuclei, ...
    BlockLocationSet=bls, BorderSize=[r r], ...
    Adapter=images.blocked.MATBlocks, OutputLocation="results_dir");
allResults = gather(bResults);  % load all structs into memory

Limit work to real data

  • Crop first. crop(bim, cstart, cend) is virtual — no data copy, executes instantly. Use to restrict to a spatial ROI or single channel before processing.
  • Use masks with selectBlockLocations. Build a mask from a coarse level, then process only blocks overlapping the ROI. See references/specialized-workflows.md for the full pattern including InclusionThreshold and block-size tuning.

Key patterns

  • Single pass. Perform all pre/post-processing inside fcn to go through data only once.
  • World coordinates. fcn receives block metadata. Use sub2world() to convert block-local positions to world coordinates before returning detection results.
  • BorderSize for overlap. Set BorderSize when the processing function needs context from neighboring blocks (e.g., DL network with wider input than output field of view).
  • Unique detections via centroids. Set BorderSize >= half the max object diameter. In the user function, discard detections whose centroid falls in the border region, then convert remaining centroids to global coordinates using bs.Start:
    matlab
    onBorder = centroids(:,1) < bs.BorderSize(1) ...
             | centroids(:,1) > size(bs.Data,1) - 2*bs.BorderSize(1) ...
             | centroids(:,2) < bs.BorderSize(2) ...
             | centroids(:,2) > size(bs.Data,2) - 2*bs.BorderSize(2);
    centroids(onBorder,:) = [];
    centroids = centroids + bs.Start(1:2);  % local -> global
    For inconsistent detectors, add a second apply() pass with BorderSize=BlockSize to deduplicate by bounding-box overlap in global coordinates.
  • Multi-resolution output. Use makeMultiLevel2D(bResult, Scales=[1 0.5 0.3 0.1]) to generate a pyramid from a single-level result. Use "nearest" interpolation for label/mask data. Or return multiple levels from fcn and combine with concatenateLevels.
  • Small block output. When per-block output is tiny (e.g., a count), use gather() to load all results into memory, or write() to rewrite with a larger block size.
  • Resume. Set Resume=true to continue a previously interrupted apply() from where it left off. For in-place resume with overwrite, see references/specialized-workflows.md.
  • Multi-output apply. When the processing function returns N outputs, apply returns N separate blockedImages. Use this to split channels in a single pass:
    matlab
    [o1, o2, o3, o4] = apply(bim, @(bs) splitChannels(bs), ...
        BlockSize=[10 2048 2048 4], UseParallel=true, OutputLocation=outDir);
  • ExtraImages for pixel-level masking. Pass a second blockedImage via ExtraImages to access it in the block function alongside the primary image. See references/specialized-workflows.md for the full pattern including resolution mismatch handling.
  • Pyramidal TIFF in one pass. Generate multi-resolution levels and write as a single pyramidal TIFF using LevelImages:
    matlab
    [b1,b2,b3,b4] = apply(bim, @resizeBlocks);
    write(bim, "pyramid.tif", LevelImages=[b1 b2 b3 b4], BlockSize=[2048 2048]);
    function [b1,b2,b3,b4] = resizeBlocks(bs)
        b1 = imresize(bs.Data, 0.5, 'nearest');
        b2 = imresize(b1, 0.5, 'nearest');
        b3 = imresize(b2, 0.5, 'nearest');
        b4 = imresize(b3, 0.5, 'nearest');
    end
  • BatchSize. Process multiple blocks at once by setting BatchSize=N. The block function receives bs.Data with an extra trailing dimension of size N and bs.BatchSize indicating the count. Useful when per-block overhead is high.

Iterative development workflow

Processing full-resolution blocked images is slow. Shorten the feedback cycle by prototyping on smaller data first:

  1. Prototype on a coarse level. Use gather(bim, Level=bim.NumLevels) to load the coarsest level into memory. Develop and tune parameters on this small image, then apply to the full image:
    matlab
    imCoarse = gather(bim, Level=bim.NumLevels);
    thresh = graythresh(im2gray(imCoarse));
    bResult = apply(bim, @(bs) ~imbinarize(im2gray(bs.Data), thresh));
  2. Prototype on an ROI. Extract a small region with representative features using getRegion, tune parameters, then apply:
    matlab
    roi = getRegion(bim, [900 2400], [1700 3300], Level=1);
    thresh = graythresh(im2gray(roi));
    bResult = apply(bim, @(bs) ~imbinarize(im2gray(bs.Data), thresh));

Parallel processing

When writing results to disk, check for Parallel Computing Toolbox and use it if available:

matlab
outDir = tempname;
usepar = ~isempty(ver("parallel"));
bResult = apply(bim, @fcn, UseParallel=usepar, OutputLocation=outDir);

Always include UseParallel when specifying OutputLocation — set it based on toolbox availability.

Visualization

Choose 2D vs 3D based on the data, not convenience:

  • 3D volumes (Z-stacks, CT, MRI, microscopy stacks): Default to volshow + viewer3d. Use OverlayData for multi-channel overlay, SlicePlanes for interactive browsing, and linkviewers for overview+detail. Read references/3d-volumes.md for full patterns. Do NOT flatten 3D data into 2D slice-by-slice viewers — that discards spatial context and ignores the 3D tooling.
  • 2D images (whole-slide, satellite, mosaics): Use imageshow + viewer2d. Read references/visualization.md for overlays, synced views, overview+detail, and annotations.

If the data has a Z/depth/slice dimension, it is 3D — use the 3D path even if each slice is a separate file.

Format Conversion

Use write(bim, destination) to convert between formats or re-chunk data:

matlab
write(bim, "output.tif", BlockSize=[512 512 3]);

For adapter selection guidance when converting (JPEG vs PNG vs H5Blocks), see "Adapter Preference for Format Conversion" in references/data-discovery.md.


Copyright 2026 The MathWorks, Inc.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Matlab Process Large Images làm được gì?

Patterns for using blockedImage to process large images, harness parallel compute for image processing, and write custom adapters. Use when writing code that creates, processes, or visualizes blockedImage objects, when implementing images.blocked.Adapter subclasses, or when a user needs help with large image data. Always use this skill when working with TIFF,GeoTIFF, .svs, .ndpi, .czi or other WSI, satellite imagery or microscopy volume image formats.

Vì sao nên dùng Matlab Process Large Images trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Matlab Process Large Images là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Matlab Process Large Images trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/image-processing-and-computer-vision/matlab-process-large-images. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Matlab Process Large Images?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Matlab Process Large Images với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Matlab Process Large Images với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Matlab Process Large Images có miễn phí không?

Kỹ năng này được matlab phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇