Skip to content

Repository files navigation

SEM analyzer

Interactive measurement & figure-prep tool for SEM (Scanning Electron Microscope) images, built with Streamlit. Calibrate from the scale bar, draw measurements in real units (µm/nm), crop the data bar, and assemble publication-ready figure panels — all in the browser.

Originally built for Hitachi S-4700 micrographs (with .txt metadata sidecars), but works with any image once a scale is set manually.


🇰🇷 한국어 사용법

설치 없이 바로 쓰기 (Windows · 권장)

  1. Releases 에서 SEM-analyzer-v1.0.0-windows.zip 을 다운로드합니다.
  2. 압축을 풀고 — 폴더 통째로 둔 채 — SEM-analyzer.exe 를 더블클릭합니다.
    • ⚠️ .exe 파일 하나만 빼내면 동작하지 않습니다 (폴더 전체가 필요).
    • SmartScreen 경고가 뜨면 추가 정보 → 실행 (서명 안 된 자체 빌드라 그렇습니다).
  3. 검은 콘솔 창이 뜨고 잠시 후 브라우저에 앱이 자동으로 열립니다. (창을 닫으면 종료)

인터넷 없이 동작하며, 올린 이미지가 PC 밖으로 나가지 않습니다.

사용 순서

  1. 이미지 불러오기 — 좌측 패널에서 ‘폴더 경로’ 또는 ‘파일 업로드’. 같은 이름의 .txt 메타데이터가 있으면 배율·스케일바를 자동 인식합니다.
  2. 스케일 보정 — ‘자동 보정’(메타데이터+스케일바 검출) 또는 ‘수동 보정’(스케일바 위에 선 긋기). 보정해야 µm 단위로 측정됩니다.
  3. 측정 — ‘직선’(길이)·‘원’(지름)을 골라 이미지 위에 그리면 값이 자동 계산되어 선 중앙에 표시되고 아래 표에 누적됩니다.
  4. 편집 — ‘선택/편집’ 모드에서 개체 클릭→이동·크기 조절. 삭제는 캔버스 아래 ↩️ 마지막 개체 삭제 / 🗑 전체 삭제 버튼 또는 Delete 키, 되돌리기 Ctrl+Z.
  5. 논문 Fig 요소 — 스케일바 자동 그리기, 패널 라벨(a, b, c…), 텍스트 박스 추가.
  6. 크롭 — 하단 장비 정보바 잘라내기.
  7. 내보내기 — ‘PNG 다운로드’(주석 포함 이미지), ‘측정값 CSV’(수치 데이터).
  8. 몽타주 — 여러 이미지를 한 장으로 배치해 비교용 그림 제작.

⚠️ 주의

현재 히타치(Hitachi) SEM 장비 이미지로만 실제 검증되었습니다. 다른 제조사 장비 이미지는 아직 적용해보지 않아 정상 작동을 보장할 수 없습니다 (특히 메타데이터 자동 인식·스케일바 자동 검출). 다른 장비 이미지는 ‘수동 보정’을 쓰고 결과를 직접 확인하세요.

개발자용 (소스로 실행)

pip install -r requirements.txt
streamlit run app.py

.exe 직접 빌드 방법은 PACKAGING.md 를 참고하세요.


Features

  • Scale calibration
    • Auto: reads the MicronMarker value from the Hitachi .txt sidecar and detects the tick-ruler scale bar in the image (cross-validated to scale inversely with magnification across an image series).
    • Manual: draw a line over any scale bar and enter its real length — works for any vendor/image (ImageJ-style "Set Scale").
  • Measurement — draw lines (length) or circles (diameter); values shown in µm/nm in a table and labeled on the image. Toggle labels on/off.
  • Drawing tools — straight line / circle / freehand, with color and width pickers.
  • Crop — auto-detect and remove the black info/data strip at the bottom.
  • Figure elements
    • New clean scale bar (length, corner, color, thickness, label).
    • Panel labels a) b) c) … in any corner, with size and background options.
    • Free text boxes at any position.
  • Montage — arrange 2 or 4 images per row into a single figure, with per-image scale bars and automatic a/b/c… panel labels. Export the combined figure (PNG) or each processed image (ZIP).
  • Export — annotated PNG and measurements CSV per image.

Install

Requires Python 3.10+.

git clone <your-repo-url>
cd SEM-analyzer
python -m venv .venv && source .venv/bin/activate   # or: uv venv .venv
pip install -r requirements.txt                      # or: uv pip install -r requirements.txt

Run

streamlit run app.py

Then open the URL it prints (default http://localhost:8501).

Distribute to non-technical users

To ship a double-click .exe (no Python needed) or a shareable web link, see PACKAGING.md.

Usage

  1. Load images — in the sidebar, either enter a folder path (Hitachi .txt sidecars next to the images are read automatically) or upload files. You may upload the matching .txt files alongside images to enable auto-calibration.
  2. Single edit · measure tab
    • Confirm/redo the scale calibration (auto, or draw a line on the scale bar).
    • Optionally crop the bottom info strip.
    • Pick a drawing mode, color, and width; draw lines/circles to measure.
    • Add a fresh scale bar, panel label, or text boxes for figures.
    • Download the annotated PNG and the measurements CSV.
  3. Montage tab — pick images in order, choose 2 or 4 per row, toggle crop / scale bar / auto panel labels, and download the combined figure or a ZIP of processed images.

Project layout

File Purpose
app.py Streamlit UI (loading, single-edit tab, montage tab)
imaging.py Pure image ops: strip detection, crop, scale-bar detection, overlays
sem_meta.py Hitachi .txt sidecar parser

Notes

  • Auto scale-bar detection is tuned for Hitachi tick-ruler markers. For other vendors, use manual calibration — it always works.
  • Bring your own SEM images; no sample data is bundled.

License

MIT — see LICENSE.

About

SEM 이미지 측정·논문 Figure 제작 도구 (Streamlit) | Interactive SEM image measurement & figure-prep tool

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages