Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [4.1.0] - Pre-release

### Added
- Edges mode (colorize like segmentation but only show edges).
- Overlay one image on another.

## [4.0.19] - Pre-release

### Added
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ A built-in, enhanced image viewer with the following capabilities:
<img src="readme-assets/segmentation-example.png" width="300" alt="Segmentation"/>
<p style="word-break: break-word; white-space: normal; margin: 0 0 8px 0;">View label images with color mapping (e.g., 0=black, 1=red, etc.).</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: 300px;">
<h4>Overlay</h4>
<div style="display:flex; gap:8px; align-items:center; justify-content:center;">
<img src="readme-assets/overlay-edge-example.png" width="140" alt="Overlay example 1"/>
<img src="readme-assets/overlay-fill-example.png" width="140" alt="Overlay example 2"/>
</div>
<p style="word-break: break-word; white-space: normal; margin: 0 0 8px 0;">Overlay one image on another</p>
</div>
</div>

### Plot Viewer
Expand Down
4 changes: 3 additions & 1 deletion icons/dist/svifpd-icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@font-face {
font-family: "svifpd-icons";
font-display: block;
src: url("./svifpd-icons.woff2?797726f429734e5d9e1970c77951bcfd") format("woff2");
src: url("./svifpd-icons.woff2?b34cdd727d5167118abfe162e0202494") format("woff2");
}

.svifpd-icons[class*='svifpd-icons-'] {
Expand Down Expand Up @@ -71,3 +71,5 @@
.svifpd-icons-tensor:before { content: "\ea6c" }
.svifpd-icons-image:before { content: "\ea6d" }
.svifpd-icons-inspect-image:before { content: "\ea6e" }
.svifpd-icons-edges:before { content: "\ea6f" }
.svifpd-icons-overlay:before { content: "\ea70" }
16 changes: 16 additions & 0 deletions icons/dist/svifpd-icons.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ <h1>svifpd-icons</h1>
<span class='label'>contrast</span>
<span class='description'></span>
</div>
<div class="icon" data-name="edges" title="edges">
<span class="inner">
<i class="svifpd-icons svifpd-icons-edges" aria-hidden="true"></i>
</span>
<br>
<span class='label'>edges</span>
<span class='description'></span>
</div>
<div class="icon" data-name="G" title="G">
<span class="inner">
<i class="svifpd-icons svifpd-icons-G" aria-hidden="true"></i>
Expand Down Expand Up @@ -233,6 +241,14 @@ <h1>svifpd-icons</h1>
<span class='label'>legend</span>
<span class='description'></span>
</div>
<div class="icon" data-name="overlay" title="overlay">
<span class="inner">
<i class="svifpd-icons svifpd-icons-overlay" aria-hidden="true"></i>
</span>
<br>
<span class='label'>overlay</span>
<span class='description'></span>
</div>
<div class="icon" data-name="R" title="R">
<span class="inner">
<i class="svifpd-icons svifpd-icons-R" aria-hidden="true"></i>
Expand Down
2 changes: 1 addition & 1 deletion icons/dist/svifpd-icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/dist/svifpd-icons.woff2
Binary file not shown.
1 change: 1 addition & 0 deletions icons/src/icons/edges.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/src/icons/overlay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion icons/src/template/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
"legend": 60011,
"tensor": 60012,
"image": 60013,
"inspect-image": 60014
"inspect-image": 60014,
"edges": 60015,
"overlay": 60016
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"publisher": "elazarcoh",
"name": "simply-view-image-for-python-debugging",
"displayName": "View Image for Python Debugging",
"version": "4.0.19",
"version": "4.1.0",
"packageManager": "yarn@4.4.1",
"description": "simply view the image of the image variables when debugging python",
"repository": {
Expand Down
Binary file added readme-assets/overlay-edge-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/overlay-fill-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions simply-view-image-for-python-debugging.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"rust": "html",
},
"rust-analyzer.check.command": "clippy",
"rust-analyzer.semanticHighlighting.strings.enable": false,
"cSpell.words": [
"colorbar"
],
Expand Down
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable perfectionist/sort-imports */
import 'reflect-metadata';
import Container from 'typedi';
import * as vscode from 'vscode';
import { AllViewables } from './AllViewables';
Expand Down Expand Up @@ -26,7 +28,6 @@ import { PlotlyFigure, PyplotAxes, PyplotFigure } from './viewable/Plot';
import { NumpyTensor, TorchTensor } from './viewable/Tensor';
import { WebviewRequests } from './webview/communication/createMessages';
import { GlobalWebviewClient } from './webview/communication/WebviewClient';
import 'reflect-metadata';

function onConfigChange(): void {
initLog();
Expand Down
2 changes: 2 additions & 0 deletions src/webview-ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ Cargo.lock

# wasm-pack
pkg/

/debug_shaders
3 changes: 3 additions & 0 deletions src/webview-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition = "2021"
rust-version = "1.80"
resolver = "2"

[build-dependencies]
shaders = { path = "shaders" }

[lib]
crate-type = [ "cdylib" ]

Expand Down
52 changes: 52 additions & 0 deletions src/webview-ui/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
use std::{env, fs, io::Write, path::PathBuf};

fn base_output() -> PathBuf {
PathBuf::from(env::var("OUT_DIR").unwrap()).join("shaders")
}

fn is_debug() -> bool {
match env::var("PROFILE") {
Ok(profile) => profile == "debug",
_ => false,
}
}

fn create_shader_file(content: &str, filename: &str) {
let base_output = base_output();

let file_path = base_output.join(filename);
let mut file = fs::File::create(file_path).expect("Unable to create file");
file.write_all(content.as_bytes())
.expect("Unable to write to file");

// Also write to project_root/debug_shaders in debug mode
if is_debug() {
let root_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let debug_dir = root_dir.join("debug_shaders");
fs::create_dir_all(&debug_dir).unwrap();

let debug_file = debug_dir.join(filename);
fs::write(&debug_file, content).unwrap();
}
}

fn main() {
let base_output = base_output();
println!("cargo:rustc-env=SHADERS_DIR={}", base_output.display());
fs::create_dir_all(&base_output).expect("Unable to create directory");

#[rustfmt::skip]
create_shader_file(shaders::UINT_FRAGMENT_SHADER, "uint-image.frag");
#[rustfmt::skip]
create_shader_file(shaders::INT_FRAGMENT_SHADER, "int-image.frag");
#[rustfmt::skip]
create_shader_file(shaders::NORMALIZED_FRAGMENT_SHADER, "normalized-image.frag");
#[rustfmt::skip]
create_shader_file(shaders::UINT_PLANAR_FRAGMENT_SHADER, "uint-planar-image.frag");
#[rustfmt::skip]
create_shader_file(shaders::INT_PLANAR_FRAGMENT_SHADER, "int-planar-image.frag");
#[rustfmt::skip]
create_shader_file(shaders::NORMALIZED_PLANAR_FRAGMENT_SHADER, "normalized-planar-image.frag");

println!("cargo:rerun-if-changed=build.rs");
}
Loading