copper3d 3.10.4 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +128 -0
  2. package/ai-index/guides/4D-MRI-LV-rendering.md +580 -0
  3. package/ai-index/guides/ai-assist-api.md +382 -0
  4. package/ai-index/guides/camera-framing.md +238 -0
  5. package/ai-index/guides/control-axes.md +124 -0
  6. package/ai-index/guides/copper3d-4D-API.md +219 -0
  7. package/ai-index/guides/copper3d-rendering-optimization.md +155 -0
  8. package/ai-index/guides/gltf-decoders.md +105 -0
  9. package/ai-index/guides/heart-sensor.md +137 -0
  10. package/ai-index/guides/load-callbacks.md +244 -0
  11. package/ai-index/guides/mcp-server.md +139 -0
  12. package/ai-index/guides/nrrd-tools.md +1888 -0
  13. package/ai-index/guides/on-demand-controls.md +154 -0
  14. package/ai-index/guides/rotation-pivot.md +197 -0
  15. package/ai-index/guides/scene-resources.md +227 -0
  16. package/ai-index/guides/segmentation-module.md +1539 -0
  17. package/ai-index/guides/surface-annotation-api.md +388 -0
  18. package/ai-index/guides/volume-display.md +194 -0
  19. package/ai-index/manifest.json +144 -0
  20. package/ai-index/symbols.json +1 -0
  21. package/dist/Utils/segmentation/DrawToolCore.d.ts +19 -0
  22. package/dist/Utils/segmentation/DrawToolCore.js +62 -36
  23. package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
  24. package/dist/Utils/segmentation/tools/DrawingTool.js +14 -2
  25. package/dist/Utils/segmentation/tools/DrawingTool.js.map +1 -1
  26. package/dist/Utils/segmentation/tools/ToolHost.d.ts +2 -1
  27. package/dist/bundle.esm.js +79 -41
  28. package/dist/bundle.umd.js +79 -41
  29. package/dist/types/Utils/segmentation/DrawToolCore.d.ts +19 -0
  30. package/dist/types/Utils/segmentation/tools/ToolHost.d.ts +2 -1
  31. package/package.json +7 -4
package/README.md CHANGED
@@ -25,6 +25,130 @@ Very old: https://www.npmjs.com/package/gltfloader-plugin-test
25
25
 
26
26
  ---
27
27
 
28
+ ### AI coding assistants (MCP)
29
+
30
+ copper3d ships a machine-readable index of its own API and guides. Point your AI
31
+ assistant at it through the [`copper3d-mcp`](https://www.npmjs.com/package/copper3d-mcp)
32
+ server and it can look up real signatures instead of inventing them.
33
+
34
+ It reads the index from the copper3d **installed in your project**, so what the
35
+ assistant sees always matches the version you actually depend on.
36
+
37
+ Four read-only tools: `copper3d_search_api`, `copper3d_get_symbol`,
38
+ `copper3d_list_guides`, `copper3d_get_guide`.
39
+
40
+ Full guide: [AI Coding Assistants (MCP)](https://linkungao.github.io/copper3d_visualisation/guide/mcp-server).
41
+
42
+ **Claude Code** — one command, no path needed:
43
+
44
+ ```bash
45
+ # just you, in this project
46
+ claude mcp add copper3d -- npx -y copper3d-mcp
47
+
48
+ # commit it to .mcp.json so the whole team gets it on clone
49
+ claude mcp add --scope project copper3d -- npx -y copper3d-mcp
50
+
51
+ # all your projects
52
+ claude mcp add --scope user copper3d -- npx -y copper3d-mcp
53
+ ```
54
+
55
+ **Every other client** needs to be told where the project is, because they start
56
+ the server with a working directory that is not your project
57
+ ([why](https://github.com/anthropics/claude-code/issues/75266)):
58
+
59
+ | Client | Config file | Root key | Needs `--project` |
60
+ |---|---|---|---|
61
+ | Claude Code | `claude mcp add`, or `.mcp.json` | `mcpServers` | no |
62
+ | Cursor | `.cursor/mcp.json` or `~/.cursor/mcp.json` | `mcpServers` | **yes** |
63
+ | VS Code / Copilot | `.vscode/mcp.json` | **`servers`** | **yes** |
64
+ | Claude Desktop | `%APPDATA%\Claude\claude_desktop_config.json`<br>`~/Library/Application Support/Claude/claude_desktop_config.json` | `mcpServers` | **yes** |
65
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` | `mcpServers` | **yes** |
66
+
67
+ <details>
68
+ <summary><b>Cursor</b> — <code>.cursor/mcp.json</code></summary>
69
+
70
+ ```json
71
+ {
72
+ "mcpServers": {
73
+ "copper3d": {
74
+ "command": "npx",
75
+ "args": ["-y", "copper3d-mcp", "--project", "/absolute/path/to/your/project"]
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ </details>
82
+
83
+ <details>
84
+ <summary><b>VS Code / Copilot</b> — <code>.vscode/mcp.json</code> (note: <code>servers</code>, not <code>mcpServers</code>)</summary>
85
+
86
+ ```json
87
+ {
88
+ "servers": {
89
+ "copper3d": {
90
+ "type": "stdio",
91
+ "command": "npx",
92
+ "args": ["-y", "copper3d-mcp", "--project", "${workspaceFolder}"]
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ </details>
99
+
100
+ <details>
101
+ <summary><b>Claude Desktop</b> — <code>claude_desktop_config.json</code></summary>
102
+
103
+ The absolute path is required here: Claude Desktop has no project, and it ignores
104
+ the `cwd` field.
105
+
106
+ ```json
107
+ {
108
+ "mcpServers": {
109
+ "copper3d": {
110
+ "command": "npx",
111
+ "args": ["-y", "copper3d-mcp", "--project", "/absolute/path/to/your/project"]
112
+ }
113
+ }
114
+ }
115
+ ```
116
+
117
+ </details>
118
+
119
+ <details>
120
+ <summary><b>Windsurf</b> — <code>~/.codeium/windsurf/mcp_config.json</code></summary>
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "copper3d": {
126
+ "command": "npx",
127
+ "args": ["-y", "copper3d-mcp", "--project", "/absolute/path/to/your/project"]
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ </details>
134
+
135
+ **If it does not work**
136
+
137
+ | Symptom | Cause | Fix |
138
+ |---|---|---|
139
+ | Tools never appear in VS Code | Used `mcpServers` in `.vscode/mcp.json` | VS Code calls it `servers` |
140
+ | "AI index was not found" | copper3d not installed, or the client lost the project directory | `npm i copper3d`, then add `--project /abs/path` |
141
+ | Assistant still invents APIs | Server not connected | `claude mcp list`, or your client's MCP panel |
142
+
143
+ You can also skip discovery entirely by setting `COPPER3D_INDEX_PATH` to the
144
+ `node_modules/copper3d/ai-index` directory.
145
+
146
+ **What it does not do.** This is documentation lookup only. copper3d is a browser
147
+ WebGL library and the server is a Node process — it cannot render a scene, run your
148
+ code, or look at a canvas.
149
+
150
+ ---
151
+
28
152
  ### Basic Usage
29
153
 
30
154
  **Load demo**
@@ -175,6 +299,10 @@ const nrrdTools = new Copper.NrrdTools(container, {
175
299
  layers: ['tumour', 'edema', 'necrosis', 'vessel']
176
300
  });
177
301
 
302
+ // Read-only reference viewer — shows the image, nothing to annotate into.
303
+ // Scrub / zoom / pan / window-level / crosshair all still work.
304
+ const reference = new Copper.NrrdTools(container, { layers: [] });
305
+
178
306
  // Optional: show current slice index in a panel
179
307
  nrrdTools.setDisplaySliceIndexPanel(document.getElementById('slice-panel') as HTMLDivElement);
180
308