daiquiri-ui 2025.12.1__py3-none-any.whl → 2026.2.0__py3-none-any.whl
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.
- daiquiri_ui/__init__.py +0 -1
- daiquiri_ui/static/assets/Anchor-0b4a3d33.js +1 -0
- daiquiri_ui/static/assets/AutoscaleOption-3cb99678.js +1 -0
- daiquiri_ui/static/assets/{BPMVideoStream-7dfae0bb.js → BPMVideoStream-c3e09e8b.js} +1 -1
- daiquiri_ui/static/assets/{CanvasEnhancer-16124b1e.js → CanvasEnhancer-dd82c090.js} +1 -1
- daiquiri_ui/static/assets/ColorMap-be59ad21.js +1 -0
- daiquiri_ui/static/assets/CompositeMap-c93f5466.js +1 -0
- daiquiri_ui/static/assets/{ConnectUtils-b8bfa186.js → ConnectUtils-3923fa2f.js} +1 -1
- daiquiri_ui/static/assets/{Console-42bf9fd1.js → Console-d0028912.js} +1 -1
- daiquiri_ui/static/assets/{Cross-d0a1a410.js → Cross-d5df0df3.js} +1 -1
- daiquiri_ui/static/assets/{CrossMarker-2285e102.js → CrossMarker-71cd11cf.js} +2 -2
- daiquiri_ui/static/assets/DraggableRect-25d91c7d.js +1 -0
- daiquiri_ui/static/assets/DropdownButton-29cc265b.js +1 -0
- daiquiri_ui/static/assets/DropdownDetector-5016908a.js +1 -0
- daiquiri_ui/static/assets/{Editor-8c26c281.js → Editor-7b500b85.js} +9 -9
- daiquiri_ui/static/assets/EditorTree-7fc000d8.js +1 -0
- daiquiri_ui/static/assets/H5Viewer-d1305c58.js +1 -0
- daiquiri_ui/static/assets/{H5WebCurvePlot-136dfa6f.js → H5WebCurvePlot-61b08211.js} +1 -1
- daiquiri_ui/static/assets/HSegment-8d2c001e.js +43 -0
- daiquiri_ui/static/assets/HardwareButton-af41c610.js +1 -0
- daiquiri_ui/static/assets/Hdf5Plot-bbffc65f.js +1 -0
- daiquiri_ui/static/assets/{HistogramDomainSlider-5572e533.js → HistogramDomainSlider-304bdab4.js} +1 -1
- daiquiri_ui/static/assets/Image-ee61818a.js +1 -0
- daiquiri_ui/static/assets/Label-9d8979b3.js +1 -0
- daiquiri_ui/static/assets/{LoadingMessage-e1e479c5.js → LoadingMessage-03b4fa4f.js} +1 -1
- daiquiri_ui/static/assets/NewScanButton-0051d220.js +1 -0
- daiquiri_ui/static/assets/NewScanButton-57cf0c17.js +1 -0
- daiquiri_ui/static/assets/OptionsProcess-da629bfb.js +1 -0
- daiquiri_ui/static/assets/ParametersList-2d01832f.js +1 -0
- daiquiri_ui/static/assets/RectRoi-3693cc65.js +1 -0
- daiquiri_ui/static/assets/RectRuler-1fee3fd8.js +543 -0
- daiquiri_ui/static/assets/RulerButton-a95a6035.js +139 -0
- daiquiri_ui/static/assets/SampleDCList-dce0bd2b.js +1 -0
- daiquiri_ui/static/assets/SampleRegistration-544aa4bd.js +1 -0
- daiquiri_ui/static/assets/SavingButton-c3efc92c.js +1 -0
- daiquiri_ui/static/assets/ScanDataService-16f29ecd.js +1 -0
- daiquiri_ui/static/assets/ScanPlot0d-67c76bfe.js +1 -0
- daiquiri_ui/static/assets/ScanPlot0dValue-c0dd01b5.js +1 -0
- daiquiri_ui/static/assets/ScanPlot1d-3c930b95.js +1 -0
- daiquiri_ui/static/assets/ScanPlot1d-ee33c98b.js +1 -0
- daiquiri_ui/static/assets/{ScanPlot2d-c49ba2bc.js → ScanPlot2d-af57d8ad.js} +1 -1
- daiquiri_ui/static/assets/{ScanTable-4e677d2b.js → ScanTable-bc13760e.js} +1 -1
- daiquiri_ui/static/assets/ScanValue-00aab91b.js +1 -0
- daiquiri_ui/static/assets/SceneScale-e2a42af2.js +1 -0
- daiquiri_ui/static/assets/SchemaForm-7d897a32.js +1 -0
- daiquiri_ui/static/assets/{ScreenScale-ae820d30.js → ScreenScale-b2417934.js} +1 -1
- daiquiri_ui/static/assets/{SelectionPoint-d30865f3.js → SelectionPoint-a2cb4dfc.js} +1 -1
- daiquiri_ui/static/assets/{StackedNameState-3f198174.js → StackedNameState-4e8dc742.js} +1 -1
- daiquiri_ui/static/assets/Statistics.worker-54a0d965.js +46 -0
- daiquiri_ui/static/assets/{Synoptic-0f3dac61.js → Synoptic-8a3c67f3.js} +5 -5
- daiquiri_ui/static/assets/TomoAlign-b80a68c3.js +7 -0
- daiquiri_ui/static/assets/TomoBeamShaping-65a115e9.js +1 -0
- daiquiri_ui/static/assets/TomoDetector-500d46af.js +1 -0
- daiquiri_ui/static/assets/TomoDetector-e04a5a8b.js +1 -0
- daiquiri_ui/static/assets/TomoDetectorView-952499e6.js +64 -0
- daiquiri_ui/static/assets/TomoHolo-db2c8449.js +1 -0
- daiquiri_ui/static/assets/TomoPusherView-a50e2acd.js +1 -0
- daiquiri_ui/static/assets/TomoReconstructedSinogram-deee0779.js +191 -0
- daiquiri_ui/static/assets/TomoScanInfo-972a690b.js +1 -0
- daiquiri_ui/static/assets/{TomoScanList-d9bea762.js → TomoScanList-ede05c2a.js} +1 -1
- daiquiri_ui/static/assets/TomoService-e9741d6a.js +1 -0
- daiquiri_ui/static/assets/TomoSinogram-dce5808e.js +1 -0
- daiquiri_ui/static/assets/TomoTiling-04701bb7.js +69 -0
- daiquiri_ui/static/assets/TwoD-fee9523f.js +3 -0
- daiquiri_ui/static/assets/TwoDObject-2f30deac.js +1 -0
- daiquiri_ui/static/assets/TwoDObjectList-458e4824.js +1 -0
- daiquiri_ui/static/assets/{UseMouseModeInteraction-fc86164b.js → UseMouseModeInteraction-51c6269c.js} +1 -1
- daiquiri_ui/static/assets/VLineRoi-b38fe841.js +1 -0
- daiquiri_ui/static/assets/{VSegment-cf1ceafc.js → VSegment-f0d42c9a.js} +2 -2
- daiquiri_ui/static/assets/VSegmentRoi-d5e035cc.js +1 -0
- daiquiri_ui/static/assets/{VideoStream-4b855f43.js → VideoStream-a5200b21.js} +1 -1
- daiquiri_ui/static/assets/{VisViewpointRestore-097e2edf.js → VisViewpointRestore-4aa338ea.js} +3 -3
- daiquiri_ui/static/assets/{WorldScale-6e6ac5b5.js → WorldScale-23bd1dfb.js} +1 -1
- daiquiri_ui/static/assets/{ZoomPanCanvas-8f437b75.js → ZoomPanCanvas-23b61dbb.js} +1 -1
- daiquiri_ui/static/assets/{colormap-344855f8.js → colormap-6e43299c.js} +1 -1
- daiquiri_ui/static/assets/fontawesomemore-webfont-6ae56ae3.woff2 +0 -0
- daiquiri_ui/static/assets/{geometry-1fc3c1a0.js → geometry-cd448ec1.js} +1 -1
- daiquiri_ui/static/assets/hooks-171c0765.js +1 -0
- daiquiri_ui/static/assets/{hooks-cf59b64f.js → hooks-e0d9229c.js} +1 -1
- daiquiri_ui/static/assets/index-779a56ef.css +9 -0
- daiquiri_ui/static/assets/{index-a0f7b98c.js → index-a9bb7636.js} +7 -7
- daiquiri_ui/static/assets/index-b3c0133a.js +3576 -0
- daiquiri_ui/static/assets/{plotly-basic-889d4727.js → plotly-basic-ccc5794d.js} +2 -2
- daiquiri_ui/static/assets/{plotly-gl2d-e2e89493.js → plotly-gl2d-345cb34a.js} +2 -2
- daiquiri_ui/static/assets/store-5d136a2c.js +1 -0
- daiquiri_ui/static/assets/{types-46afffa0.js → types-c366a377.js} +1 -1
- daiquiri_ui/static/index.html +2 -2
- daiquiri_ui/static/meta.json +1 -1
- {daiquiri_ui-2025.12.1.dist-info → daiquiri_ui-2026.2.0.dist-info}/METADATA +1 -1
- daiquiri_ui-2026.2.0.dist-info/RECORD +134 -0
- {daiquiri_ui-2025.12.1.dist-info → daiquiri_ui-2026.2.0.dist-info}/WHEEL +1 -1
- daiquiri_ui/static/assets/Anchor-3fa6d19c.js +0 -1
- daiquiri_ui/static/assets/AutoscaleOption-d8d0ca8d.js +0 -1
- daiquiri_ui/static/assets/DraggableRect-db33e02e.js +0 -1
- daiquiri_ui/static/assets/DropdownButton-d066ece0.js +0 -1
- daiquiri_ui/static/assets/DropdownDetector-4ddfa946.js +0 -1
- daiquiri_ui/static/assets/EditorTree-b390ece1.js +0 -1
- daiquiri_ui/static/assets/H5Viewer-bbcf29f5.js +0 -1
- daiquiri_ui/static/assets/HSegment-8966b13f.js +0 -43
- daiquiri_ui/static/assets/HardwareButton-2e65150e.js +0 -1
- daiquiri_ui/static/assets/Hdf5Plot-3b35de75.js +0 -1
- daiquiri_ui/static/assets/Image-1ff7dca9.js +0 -1
- daiquiri_ui/static/assets/Label-3c95fb14.js +0 -1
- daiquiri_ui/static/assets/NewScanButton-25f65a41.js +0 -1
- daiquiri_ui/static/assets/NewScanButton-f40700e9.js +0 -1
- daiquiri_ui/static/assets/OptionsProcess-6fd11ce7.js +0 -1
- daiquiri_ui/static/assets/ParametersList-c91938bf.js +0 -1
- daiquiri_ui/static/assets/RectRoi-19381507.js +0 -1
- daiquiri_ui/static/assets/RulerButton-5c2020aa.js +0 -139
- daiquiri_ui/static/assets/SampleDCList-64bd9100.js +0 -1
- daiquiri_ui/static/assets/SampleRegistration-a354b270.js +0 -1
- daiquiri_ui/static/assets/SavingButton-c1839199.js +0 -1
- daiquiri_ui/static/assets/ScanPlot0d-d180ecd3.js +0 -1
- daiquiri_ui/static/assets/ScanPlot0dValue-0e33cb2c.js +0 -1
- daiquiri_ui/static/assets/ScanPlot1d-38bddb23.js +0 -1
- daiquiri_ui/static/assets/ScanPlot1d-543e4ac4.js +0 -1
- daiquiri_ui/static/assets/ScanValue-a303a86d.js +0 -1
- daiquiri_ui/static/assets/SceneScale-33094e68.js +0 -1
- daiquiri_ui/static/assets/SchemaForm-b27ccd55.js +0 -1
- daiquiri_ui/static/assets/TomoAlign-03e37551.js +0 -4
- daiquiri_ui/static/assets/TomoBeamShaping-6ec15838.js +0 -1
- daiquiri_ui/static/assets/TomoDetector-aead72a5.js +0 -1
- daiquiri_ui/static/assets/TomoDetectorView-aadf1539.js +0 -64
- daiquiri_ui/static/assets/TomoHolo-7eb20a1e.js +0 -1
- daiquiri_ui/static/assets/TomoReconstructedSinogram-53bbfb3b.js +0 -191
- daiquiri_ui/static/assets/TomoScanInfo-5ca06333.js +0 -1
- daiquiri_ui/static/assets/TomoSinogram-ecd9dca2.js +0 -1
- daiquiri_ui/static/assets/TomoTiling-1b9f4bf4.js +0 -69
- daiquiri_ui/static/assets/TwoD-ca5cd677.js +0 -3
- daiquiri_ui/static/assets/TwoDObject-86b91ffb.js +0 -1
- daiquiri_ui/static/assets/TwoDObjectList-143af6e7.js +0 -1
- daiquiri_ui/static/assets/VLineRoi-5130fa5a.js +0 -1
- daiquiri_ui/static/assets/colors-2395de5a.js +0 -1
- daiquiri_ui/static/assets/fontawesomemore-webfont-97d0220a.woff2 +0 -0
- daiquiri_ui/static/assets/hooks-457bfe32.js +0 -1
- daiquiri_ui/static/assets/index-0751d893.js +0 -3576
- daiquiri_ui/static/assets/index-f085dfca.css +0 -9
- daiquiri_ui/static/assets/store-c3eddf46.js +0 -1
- daiquiri_ui/static/resources/shaders/compare.frag.glsl +0 -386
- daiquiri_ui/static/resources/shaders/compare.vert.glsl +0 -11
- daiquiri_ui-2025.12.1.dist-info/RECORD +0 -128
- {daiquiri_ui-2025.12.1.dist-info → daiquiri_ui-2026.2.0.dist-info}/licenses/LICENSE +0 -0
- {daiquiri_ui-2025.12.1.dist-info → daiquiri_ui-2026.2.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import{r as m,b6 as se,b7 as ue,b8 as fe,b9 as de,ba as me,bb as q,bc as xe,bd as ve,be as Q,bf as ge,bg as he,aQ as be,aU as ae,aX as H,j as i,aV as re,I as Y,F as oe,aL as ye,aH as Ce,aW as Se}from"./index-b3c0133a.js";import{o as W,h as ze}from"./index-a9bb7636.js";import{N as _e}from"./hooks-171c0765.js";import{A as U,d as Z}from"./colormap-6e43299c.js";import{S as $}from"./ScreenScale-b2417934.js";import{D as ie,S as Ne,Z as Ae,a as Re,A as M}from"./DraggableRect-25d91c7d.js";import{D as Ie}from"./DropdownButton-29cc265b.js";import{u as Oe}from"./UseMouseModeInteraction-51c6269c.js";import{A as k}from"./Anchor-0b4a3d33.js";import{H as J,V as K}from"./VSegmentRoi-d5e035cc.js";import{c as Te,L as p}from"./Label-9d8979b3.js";function X(e){const n=m.useRef();return m.useEffect(()=>{n.current=e}),n.current}var O=(e=>(e[e.NONE=0]="NONE",e[e.LAPLACIAN_3x3=1]="LAPLACIAN_3x3",e[e.LAPLACIAN_9x9=2]="LAPLACIAN_9x9",e[e.SHARPENING_3x3=3]="SHARPENING_3x3",e[e.UNSHARPENING_3x3=4]="UNSHARPENING_3x3",e[e.UNSHARPENING_5x5=5]="UNSHARPENING_5x5",e[e.SMOOTH_3x3=6]="SMOOTH_3x3",e[e.SMOOTH_5x5=7]="SMOOTH_5x5",e[e.SMOOTH_7x7=8]="SMOOTH_7x7",e))(O||{});const P={0:{name:"No filter",size:0,coefs:Float32Array.from([0,0,0,0,0,0,0,0,0])},1:{name:"Laplacian 3×3",size:3,coefs:Float32Array.from([0,-1,0,-1,4,-1,0,-1,0])},2:{name:"Laplacian 9×9",size:9,coefs:Float32Array.from([0,1,1,2,2,2,1,1,0,1,2,4,5,5,5,4,2,1,1,4,5,3,0,3,5,4,1,2,5,3,-12,-24,-12,3,5,2,2,5,0,-24,-40,-24,0,5,2,2,5,3,-12,-24,-12,3,5,2,1,4,5,3,0,3,5,4,1,1,2,4,5,5,5,4,2,1,0,1,1,2,2,2,1,1,0])},3:{name:"Sharpening 3×3",size:3,coefs:Float32Array.from([-1,-1,-1,-1,9,-1,-1,-1,-1])},4:{name:"Unsharpening 3×3",size:3,coefs:Float32Array.from([0,-1,0,-1,5,-1,0,-1,0])},5:{name:"Unsharpening 5×5",size:5,coefs:Float32Array.from([1/256,4/256,6/256,4/256,1/256,4/256,16/256,24/256,16/256,4/256,6/256,24/256,-476/256,24/256,6/256,4/256,16/256,24/256,16/256,4/256,1/256,4/256,6/256,4/256,1/256])},6:{name:"Gaussian 3×3",size:3,coefs:Float32Array.from([1/16,2/16,1/16,2/16,4/16,2/16,1/16,2/16,1/16])},7:{name:"Gaussian 5×5",size:5,coefs:Float32Array.from([1/273,4/273,7/273,4/273,1/273,4/273,16/273,26/273,16/273,4/273,7/273,26/273,41/273,26/273,7/273,4/273,16/273,26/273,16/273,4/273,1/273,4/273,7/273,4/273,1/273])},8:{name:"Gaussian 7×7",size:7,coefs:Float32Array.from([1/4096,6/4096,15/4096,20/4096,15/4096,6/4096,1/4096,6/4096,36/4096,90/4096,120/4096,90/4096,36/4096,6/4096,15/4096,90/4096,225/4096,300/4096,225/4096,90/4096,15/4096,20/4096,120/4096,300/4096,400/4096,300/4096,120/4096,20/4096,15/4096,90/4096,225/4096,300/4096,225/4096,90/4096,15/4096,6/4096,36/4096,90/4096,120/4096,90/4096,36/4096,6/4096,1/4096,6/4096,15/4096,20/4096,15/4096,6/4096,1/4096])}},Fe={float32:xe,float16:ve,uint8:Q,uint16:ge,uint32:he,uint8_clamped:Q};function Ee(e,n){if(e===void 0)return;const[r,c]=e.shape,t=n!=null&&n.magNearest?se:ue,a=new fe(e.data,c,r,de,Fe[e.dtype],me,q,q,t);return a.needsUpdate=!0,a}function ee(e,n){return m.useMemo(()=>Ee(e,n),[e,n])}const ne="#### END OF HEADER ####";function ce(e){const n=e.indexOf(ne);return n===-1?e:e.slice(n+ne.length)}const je=`#version 400
|
|
2
|
+
|
|
3
|
+
// Shader used in threefiber context
|
|
4
|
+
// This code is concatenaed with threefiber headers
|
|
5
|
+
// So we specify this header for validation purpose
|
|
6
|
+
// But it is dropped before it is used by threefiber
|
|
7
|
+
|
|
8
|
+
// #### END OF HEADER ####
|
|
9
|
+
// Only the following code is passed to threefiber
|
|
10
|
+
|
|
11
|
+
struct Normalization {
|
|
12
|
+
// data min
|
|
13
|
+
float min;
|
|
14
|
+
// data max
|
|
15
|
+
float max;
|
|
16
|
+
// 0: no normalization, 1: project 0..1 to min..max
|
|
17
|
+
int mode;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
struct Domain {
|
|
21
|
+
float min;
|
|
22
|
+
float max;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
uniform sampler2D textureA;
|
|
26
|
+
uniform Normalization normA;
|
|
27
|
+
uniform sampler2D textureB;
|
|
28
|
+
uniform Normalization normB;
|
|
29
|
+
|
|
30
|
+
uniform int mode;
|
|
31
|
+
uniform float imageATranslationX;
|
|
32
|
+
uniform float imageARotation;
|
|
33
|
+
uniform float imageBTranslationX;
|
|
34
|
+
uniform float imageBRotation;
|
|
35
|
+
uniform float imageBFlipX;
|
|
36
|
+
uniform float sizeCoef;
|
|
37
|
+
uniform Domain domain;
|
|
38
|
+
uniform float verticalSeparator;
|
|
39
|
+
uniform int kernelSize;
|
|
40
|
+
uniform float kernelCoefs[9];
|
|
41
|
+
|
|
42
|
+
in vec2 texCoord;
|
|
43
|
+
|
|
44
|
+
vec2 rotatedVec2(vec2 uv, vec2 axis, float angle)
|
|
45
|
+
{
|
|
46
|
+
mat2 m = mat2(
|
|
47
|
+
vec2(cos(angle), -sin(angle)),
|
|
48
|
+
vec2(sin(angle), cos(angle))
|
|
49
|
+
);
|
|
50
|
+
return (uv - axis) * m + axis;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Convert a normalized texture into final data.
|
|
55
|
+
*/
|
|
56
|
+
float denormalize(float p, Normalization norm) {
|
|
57
|
+
if (norm.mode == 0) {
|
|
58
|
+
return p;
|
|
59
|
+
}
|
|
60
|
+
if (norm.mode == 1) {
|
|
61
|
+
return norm.min + p * (norm.max - norm.min);
|
|
62
|
+
}
|
|
63
|
+
return -1.0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
float getPixel(
|
|
67
|
+
vec2 coord,
|
|
68
|
+
sampler2D textureN,
|
|
69
|
+
Normalization normN,
|
|
70
|
+
float rotation
|
|
71
|
+
) {
|
|
72
|
+
ivec2 itexSize = textureSize(textureN, 0);
|
|
73
|
+
vec2 texSize = vec2(itexSize) * 0.5;
|
|
74
|
+
coord = (coord - vec2(0.5, 0.5)) * texSize;
|
|
75
|
+
coord = rotatedVec2(coord, vec2(0.0, 0.0), rotation);
|
|
76
|
+
coord = (coord / texSize) + vec2(0.5, 0.5);
|
|
77
|
+
|
|
78
|
+
if (coord.x < 0.0) { return -1.0; }
|
|
79
|
+
if (coord.x > 1.0) { return -1.0; }
|
|
80
|
+
if (coord.y < 0.0) { return -1.0; }
|
|
81
|
+
if (coord.y > 1.0) { return -1.0; }
|
|
82
|
+
float p = texture2D(textureN, coord).r;
|
|
83
|
+
p = denormalize(p, normN);
|
|
84
|
+
p = (p - domain.min) / (domain.max - domain.min);
|
|
85
|
+
p = clamp(p, 0.0, 1.0);
|
|
86
|
+
return p;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
float getFilteredPixel(
|
|
90
|
+
vec2 coord,
|
|
91
|
+
sampler2D textureN,
|
|
92
|
+
Normalization normN,
|
|
93
|
+
float rotation
|
|
94
|
+
) {
|
|
95
|
+
ivec2 itexSize = textureSize(textureN, 0);
|
|
96
|
+
vec2 texSize = vec2(itexSize) * 0.5;
|
|
97
|
+
coord = (coord - vec2(0.5, 0.5)) * texSize;
|
|
98
|
+
|
|
99
|
+
float cum_p = 0.0;
|
|
100
|
+
int cum_coef = 0;
|
|
101
|
+
int i = 0;
|
|
102
|
+
|
|
103
|
+
for (int x = 0; x < kernelSize; x++) {
|
|
104
|
+
for (int y = 0; y < kernelSize; y++) {
|
|
105
|
+
vec2 xy = vec2(x - (kernelSize - 1) / 2, y - (kernelSize - 1) / 2);
|
|
106
|
+
vec2 coord2 = rotatedVec2(coord + xy * 1.0, vec2(0.0, 0.0), rotation);
|
|
107
|
+
coord2 = (coord2 / texSize) + vec2(0.5, 0.5);
|
|
108
|
+
|
|
109
|
+
float coef = kernelCoefs[i];
|
|
110
|
+
i++;
|
|
111
|
+
|
|
112
|
+
if (coord2.x < 0.0) { continue; }
|
|
113
|
+
if (coord2.x > 1.0) { continue; }
|
|
114
|
+
if (coord2.y < 0.0) { continue; }
|
|
115
|
+
if (coord2.y > 1.0) { continue; }
|
|
116
|
+
|
|
117
|
+
float p = texture2D(textureN, coord2).r;
|
|
118
|
+
p = denormalize(p, normN);
|
|
119
|
+
p = (p - domain.min) / (domain.max - domain.min);
|
|
120
|
+
p = clamp(p, 0.0, 1.0);
|
|
121
|
+
cum_p += p * coef;
|
|
122
|
+
cum_coef++;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (cum_coef == 0) {
|
|
126
|
+
return -1.0;
|
|
127
|
+
}
|
|
128
|
+
return clamp(cum_p, 0.0, 1.0);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
vec4 colorize_a(float a, float b) {
|
|
132
|
+
if (a < 0.0) {
|
|
133
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
134
|
+
}
|
|
135
|
+
return vec4(a, a, a, 1.0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
vec4 colorize_b(float a, float b) {
|
|
139
|
+
if (b < 0.0) {
|
|
140
|
+
return vec4(0.0, a, a, 0.75);
|
|
141
|
+
}
|
|
142
|
+
return vec4(b, b, b, 1.0);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
vec4 colorize_mul(float a, float b) {
|
|
146
|
+
// multiply
|
|
147
|
+
if (a < 0.0) {
|
|
148
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
149
|
+
}
|
|
150
|
+
if (b < 0.0) {
|
|
151
|
+
return vec4(0.0, a, a, 0.75);
|
|
152
|
+
}
|
|
153
|
+
float m = a * b;
|
|
154
|
+
return vec4(m, m, m, 1.0);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
vec4 colorize_mul_color(float a, float b) {
|
|
158
|
+
// multiply
|
|
159
|
+
if (a < 0.0) {
|
|
160
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
161
|
+
}
|
|
162
|
+
if (b < 0.0) {
|
|
163
|
+
return vec4(0.0, a, a, 0.75);
|
|
164
|
+
}
|
|
165
|
+
float m = a * b;
|
|
166
|
+
return vec4(m, (b + a ) * 0.5, b, 1.0);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
vec4 colorize_diff(float a, float b) {
|
|
170
|
+
if (a < 0.0) {
|
|
171
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
172
|
+
}
|
|
173
|
+
if (b < 0.0) {
|
|
174
|
+
return vec4(0.0, a, a, 0.75);
|
|
175
|
+
}
|
|
176
|
+
float i = 0.5 + (a - b);
|
|
177
|
+
return vec4(i, i, i, 1.0);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
vec4 colorize_diff_color(float a, float b) {
|
|
181
|
+
if (a < 0.0) {
|
|
182
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
183
|
+
}
|
|
184
|
+
if (b < 0.0) {
|
|
185
|
+
return vec4(0.0, a, a, 0.75);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
float i = (a - b) * 10.0;
|
|
189
|
+
if (i > 1.0) {
|
|
190
|
+
i = 1.0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
float da = (i > 0.0) ? i : 0.0;
|
|
194
|
+
float db = (i < 0.0) ? -i : 0.0;
|
|
195
|
+
return vec4(1.0 - da - db * 0.5, 1.0, 1.0 - db * 0.5, 1.0);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
vec4 colorize_min(float a, float b) {
|
|
199
|
+
if (a < 0.0) {
|
|
200
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
201
|
+
}
|
|
202
|
+
if (b < 0.0) {
|
|
203
|
+
return vec4(0.0, a, a, 0.75);
|
|
204
|
+
}
|
|
205
|
+
float m = min(a, b);
|
|
206
|
+
return vec4(m, m, m, 1.0);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
vec4 colorize_min_color(float a, float b) {
|
|
210
|
+
if (a < 0.0) {
|
|
211
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
212
|
+
}
|
|
213
|
+
if (b < 0.0) {
|
|
214
|
+
return vec4(0.0, a, a, 0.75);
|
|
215
|
+
}
|
|
216
|
+
float m = min(a, b);
|
|
217
|
+
return vec4(m, (b + a ) * 0.5, b, 1.0);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
vec4 colorize_max(float a, float b) {
|
|
221
|
+
if (a < 0.0) {
|
|
222
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
223
|
+
}
|
|
224
|
+
if (b < 0.0) {
|
|
225
|
+
return vec4(0.0, a, a, 0.75);
|
|
226
|
+
}
|
|
227
|
+
float m = max(a, b);
|
|
228
|
+
return vec4(m, m, m, 1.0);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
vec4 colorize_max_color(float a, float b) {
|
|
232
|
+
if (a < 0.0) {
|
|
233
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
234
|
+
}
|
|
235
|
+
if (b < 0.0) {
|
|
236
|
+
return vec4(0.0, a, a, 0.75);
|
|
237
|
+
}
|
|
238
|
+
float m = max(a, b);
|
|
239
|
+
return vec4(min(a, b), m, a, 1.0);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
vec4 colorize_error(float a, float b) {
|
|
243
|
+
if (a < 0.0) {
|
|
244
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
245
|
+
}
|
|
246
|
+
if (b < 0.0) {
|
|
247
|
+
return vec4(0.0, a, a, 0.75);
|
|
248
|
+
}
|
|
249
|
+
float error = sqrt(abs(a - b));
|
|
250
|
+
float i = 1.0 - error;
|
|
251
|
+
return vec4(i, i, i, 1.0);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
vec4 colorize_error_color(float a, float b) {
|
|
255
|
+
if (a < 0.0) {
|
|
256
|
+
return vec4(0.0, b, 0.0, 0.75);
|
|
257
|
+
}
|
|
258
|
+
if (b < 0.0) {
|
|
259
|
+
return vec4(0.0, a, a, 0.75);
|
|
260
|
+
}
|
|
261
|
+
float d = a - b;
|
|
262
|
+
float s = sign(d);
|
|
263
|
+
|
|
264
|
+
float i = 1.0 - abs(d);
|
|
265
|
+
i = i * i * i;
|
|
266
|
+
float da = (s > 0.0) ? i : 0.0;
|
|
267
|
+
float db = (s < 0.0) ? i : 0.0;
|
|
268
|
+
return vec4(1.0 - da - db * 0.6, 1.0, 1.0 - db * 0.6, 1.0);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
vec4 colorize_hspliter(float a, float b) {
|
|
272
|
+
ivec2 itexSize = textureSize(textureA, 0);
|
|
273
|
+
vec2 texSize = vec2(itexSize);
|
|
274
|
+
if (-((texCoord.y - 0.5) * texSize.y * sizeCoef) < verticalSeparator) {
|
|
275
|
+
if (a < 0.0) {
|
|
276
|
+
discard;
|
|
277
|
+
}
|
|
278
|
+
return vec4(a, a, a, 1.0);
|
|
279
|
+
} else {
|
|
280
|
+
if (b < 0.0) {
|
|
281
|
+
discard;
|
|
282
|
+
}
|
|
283
|
+
return vec4(b, b, b, 1.0);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
vec4 colorize_hspliter_color(float a, float b) {
|
|
288
|
+
ivec2 itexSize = textureSize(textureA, 0);
|
|
289
|
+
vec2 texSize = vec2(itexSize);
|
|
290
|
+
if (-((texCoord.y - 0.5) * texSize.y * sizeCoef) < verticalSeparator) {
|
|
291
|
+
if (a < 0.0) {
|
|
292
|
+
discard;
|
|
293
|
+
}
|
|
294
|
+
return vec4(0.0, a, a, 1.0);
|
|
295
|
+
} else {
|
|
296
|
+
if (b < 0.0) {
|
|
297
|
+
discard;
|
|
298
|
+
}
|
|
299
|
+
return vec4(0.0, b, 0.0, 1.0);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
vec4 colorize_custom_func(float a, float b) {
|
|
304
|
+
// CUSTOM FUNC INJECTION //;
|
|
305
|
+
return vec4(0.0, 0.0, 0.0, 1.0);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
/*
|
|
310
|
+
// error without killing the content
|
|
311
|
+
float error = sqrt(abs(a - b));
|
|
312
|
+
float i = 1.0 - error;
|
|
313
|
+
float m = 1.0 - max(a,b);
|
|
314
|
+
return vec4(i, 1.0 - a, 1.0 - b, 1.0);
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
float pixelToTexture(float pixel, sampler2D textureN) {
|
|
321
|
+
ivec2 itexSize = textureSize(textureN, 0);
|
|
322
|
+
vec2 texSize = vec2(itexSize);
|
|
323
|
+
float size = max(texSize.x, texSize.y);
|
|
324
|
+
return pixel / size;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
void main() {
|
|
328
|
+
float transTexA = pixelToTexture(imageATranslationX, textureA);
|
|
329
|
+
vec2 texCoordA = vec2(texCoord.x + transTexA, texCoord.y);
|
|
330
|
+
|
|
331
|
+
float coefB;
|
|
332
|
+
float transTexB = pixelToTexture(-imageBTranslationX, textureB);
|
|
333
|
+
vec2 texCoordB;
|
|
334
|
+
if (imageBFlipX > 0.0) {
|
|
335
|
+
// mirrored
|
|
336
|
+
coefB = -1.0;
|
|
337
|
+
texCoordB = vec2(1.0 - texCoord.x + transTexB, texCoord.y);
|
|
338
|
+
} else {
|
|
339
|
+
coefB = 1.0;
|
|
340
|
+
texCoordB = vec2(texCoord.x + transTexB, texCoord.y);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
float a;
|
|
344
|
+
float b;
|
|
345
|
+
if (kernelSize == 0) {
|
|
346
|
+
a = getPixel(texCoordA, textureA, normA, imageARotation);
|
|
347
|
+
b = getPixel(texCoordB, textureB, normB, coefB * imageBRotation);
|
|
348
|
+
} else {
|
|
349
|
+
a = getFilteredPixel(texCoordA, textureA, normA, imageARotation);
|
|
350
|
+
b = getFilteredPixel(texCoordB, textureB, normB, coefB * imageBRotation);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (a < 0.0 && b < 0.0) {
|
|
354
|
+
discard;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
vec4 c;
|
|
358
|
+
switch (mode) {
|
|
359
|
+
case 0:
|
|
360
|
+
discard;
|
|
361
|
+
case 1:
|
|
362
|
+
c = colorize_a(a, b);
|
|
363
|
+
break;
|
|
364
|
+
case 2:
|
|
365
|
+
c = colorize_b(a, b);
|
|
366
|
+
break;
|
|
367
|
+
|
|
368
|
+
case 100:
|
|
369
|
+
c = colorize_diff(a, b);
|
|
370
|
+
break;
|
|
371
|
+
case 101:
|
|
372
|
+
c = colorize_error(a, b);
|
|
373
|
+
break;
|
|
374
|
+
case 102:
|
|
375
|
+
c = colorize_max(a, b);
|
|
376
|
+
break;
|
|
377
|
+
case 103:
|
|
378
|
+
c = colorize_min(a, b);
|
|
379
|
+
break;
|
|
380
|
+
case 104:
|
|
381
|
+
c = colorize_mul(a, b);
|
|
382
|
+
break;
|
|
383
|
+
case 105:
|
|
384
|
+
c = colorize_hspliter(a, b);
|
|
385
|
+
break;
|
|
386
|
+
|
|
387
|
+
case 200:
|
|
388
|
+
c = colorize_diff_color(a, b);
|
|
389
|
+
break;
|
|
390
|
+
case 201:
|
|
391
|
+
c = colorize_error_color(a, b);
|
|
392
|
+
break;
|
|
393
|
+
case 202:
|
|
394
|
+
c = colorize_max_color(a, b);
|
|
395
|
+
break;
|
|
396
|
+
case 203:
|
|
397
|
+
c = colorize_min_color(a, b);
|
|
398
|
+
break;
|
|
399
|
+
case 204:
|
|
400
|
+
c = colorize_mul_color(a, b);
|
|
401
|
+
break;
|
|
402
|
+
case 205:
|
|
403
|
+
c = colorize_hspliter_color(a, b);
|
|
404
|
+
break;
|
|
405
|
+
|
|
406
|
+
case 300:
|
|
407
|
+
c = colorize_custom_func(a, b);
|
|
408
|
+
break;
|
|
409
|
+
default:
|
|
410
|
+
c = vec4(1.0, 0.0, 0.0, 1.0);
|
|
411
|
+
}
|
|
412
|
+
gl_FragColor = c;
|
|
413
|
+
}
|
|
414
|
+
`,we=`#version 400
|
|
415
|
+
|
|
416
|
+
// Shader used in threefiber context
|
|
417
|
+
// This code is concatenaed with threefiber headers
|
|
418
|
+
// So we specify this header for validation purpose
|
|
419
|
+
// But it is dropped before it is used by threefiber
|
|
420
|
+
|
|
421
|
+
in vec4 projectionMatrix; // declared by threefiber
|
|
422
|
+
in vec4 modelViewMatrix; // declared by threefiber
|
|
423
|
+
in vec3 position; // declared by threefiber
|
|
424
|
+
|
|
425
|
+
// #### END OF HEADER ####
|
|
426
|
+
// Only the following code is passed to threefiber
|
|
427
|
+
|
|
428
|
+
uniform sampler2D proj0Map;
|
|
429
|
+
uniform float sizeCoef;
|
|
430
|
+
out vec2 texCoord;
|
|
431
|
+
|
|
432
|
+
void main() {
|
|
433
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
434
|
+
// texCoord = ((gl_Position.xy - vec2(-2.5)) / 5.0);
|
|
435
|
+
ivec2 itexSize = textureSize(proj0Map, 0);
|
|
436
|
+
vec2 texSize = vec2(itexSize);
|
|
437
|
+
texCoord = (vec2(position.x, -position.y) / (texSize*sizeCoef)) + 0.5;
|
|
438
|
+
}
|
|
439
|
+
`,V=ce(je),Be=ce(we);be("daiquiri.components.h5web.items.CompareMesh");var Le=(e=>(e[e.EMPTY=0]="EMPTY",e[e.IMAGE_A=1]="IMAGE_A",e[e.IMAGE_B=2]="IMAGE_B",e[e.DIFF=100]="DIFF",e[e.ERROR=101]="ERROR",e[e.MAX=102]="MAX",e[e.MIN=103]="MIN",e[e.MUL=104]="MUL",e[e.HSPLITTER=105]="HSPLITTER",e[e.DIFF_COLOR=200]="DIFF_COLOR",e[e.ERROR_COLOR=201]="ERROR_COLOR",e[e.MAX_COLOR=202]="MAX_COLOR",e[e.MIN_COLOR=203]="MIN_COLOR",e[e.MUL_COLOR=204]="MUL_COLOR",e[e.HSPLITTER_COLOR=205]="HSPLITTER_COLOR",e[e.CUSTOM=300]="CUSTOM",e))(Le||{});class Pe extends re{constructor(){super({uniforms:{textureA:{value:null},normA:{value:{min:0,max:0,mode:0}},textureB:{value:null},normB:{value:{min:0,max:0,mode:0}},mode:{value:0},sizeCoef:{value:1},imageARotation:{value:0},imageATranslationX:{value:0},imageBRotation:{value:0},imageBTranslationX:{value:0},imageBFlipX:{value:0},domain:{value:{min:0,max:1}},verticalSeparator:{value:0},kernelCoefs:{value:Float32Array.from([0,0,0,0,0,0,0,0,0])},kernelSize:{value:0}}})}}ae({CompareMaterial:Pe});function Me(e,n,r){return n===1||(n===105||n===205)&&e.y<r?-1:1}function ke(e){const{translationA:n,translationB:r,threshold:c=4,displayMode:t,verticalSeparator:a,disabled:f}=e,l=m.useRef(void 0),u=m.useCallback(o=>{const s=Me(o.dataPt,t,a);l.current={translationA:n,translationB:r,startData:o.dataPt,startScreen:o.htmlPt,gestureStarted:!1,coef:s}},[n,r,t,a]),d=m.useCallback(o=>{const s=l.current;if(s===void 0)return!1;const{htmlPt:S}=o;return Math.max(Math.abs(S.x-s.startScreen.x),Math.abs(S.y-s.startScreen.y))<=c},[c]),v=m.useCallback(o=>{const s=l.current;if(s===void 0)return;if(!s.gestureStarted){if(d(o))return;l.current={...s,gestureStarted:!0}}const S=o.dataPt.x-s.startData.x;e.onIntermediateChanged(s.translationA+S*s.coef,s.translationB+S*s.coef)},[d,e.onIntermediateChanged]),b=m.useCallback(o=>{const s=l.current;if(s){const S=o.dataPt.x-s.startData.x;e.onChanged(s.translationA+S*s.coef,s.translationB+S*s.coef)}l.current=void 0},[d,e.onChanged]);function _(){return W("pointerdown",u),W("pointermove",v),W("pointerup",b),i.jsx(i.Fragment,{})}return i.jsx(i.Fragment,{children:!f&&i.jsx(_,{})})}function Ge(e,n,r){switch(e){case U.None:return[0,1];case U.Minmax:return[Math.min(n.min??0,r.min??0),Math.max(n.max??1,r.max??1)];case U.StdDev3:{const c=Math.min(n.min??0,r.min??0),t=Math.max(n.max??1,r.max??1),a=((n.mean??.5)+(r.mean??.5))*.5,f=((n.std??.5)+(r.std??.5))*.5;return[Math.max(c,a-3*f),Math.min(t,a+3*f)]}default:console.warn(`Unsupported norm ${e}`)}return[0,1]}function pe(e){var N;const n=m.useRef(null),{displayMode:r=1,imageARotation:c=0,imageATranslationX:t=0,imageBRotation:a=0,imageBTranslationX:f=0,imageBFlipX:l=!0,autoScale:u=U.None,stateA:d,stateB:v,verticalSeparator:b=0,customFunc:_,filterMode:o=O.NONE,translationXInteration:s=!1,pixelSize:S}=e,[F,B]=m.useState(0),A=m.useMemo(()=>S===void 0?1:S,[e.pixelSize]),L=m.useMemo(()=>_===void 0?V:V.replace("// CUSTOM FUNC INJECTION //",_),[V,_]),E=ee(e.imageA,{magNearest:!0}),R=ee(e.imageB,{magNearest:!0}),[T,I]=m.useMemo(()=>{if(o in P){const{size:w,coefs:le}=P[o];return[w,le]}console.log(`Unsupported ${o}`);const{size:x,coefs:j}=P[O.NONE];return[x,j]},[o]);m.useEffect(()=>{B(x=>x+1)},[L]);const y=m.useMemo(()=>d===void 0||v===void 0?d!==void 0?Z(u,d):v!==void 0?Z(u,v):[0,1]:Ge(u,d,v),[d,v,u]),g=m.useMemo(()=>E===void 0||R===void 0?r<10?r:E!==void 0?1:R!==void 0?2:0:r,[r,E===void 0,R===void 0]);m.useEffect(()=>{if(n.current){const x=n.current.uniforms;x.mode.value=g,x.sizeCoef.value=A,x.imageARotation.value=c,x.imageATranslationX.value=t,x.imageBRotation.value=a,x.imageBTranslationX.value=f,x.imageBFlipX.value=l?1:0,x.domain.value={min:y[0],max:y[1]},x.verticalSeparator.value=b,x.kernelCoefs.value=I,x.kernelSize.value=T,H()}},[n.current,g,A,c,t,a,f,l,d,v,y,b,I,T,F]);function C(x){return x instanceof _e?{min:x.transfer.min,max:x.transfer.max,mode:1}:{min:0,max:0,mode:0}}m.useEffect(()=>{if(n.current){const x=n.current.uniforms;x.textureA.value=E,x.normA.value=C(e.imageA),H()}},[F,E,n.current]),m.useEffect(()=>{if(n.current){const x=n.current.uniforms;x.textureB.value=R,x.normB.value=C(e.imageB),H()}},[F,R,n.current]);const[z,h]=((N=e.imageA)==null?void 0:N.shape)??[1024,1024];return g===0?i.jsx(i.Fragment,{}):i.jsxs("mesh",{children:[i.jsx("planeGeometry",{attach:"geometry",args:[h*A*2,z*A*2,1,1]}),i.jsx(ke,{translationA:t*A,translationB:f*A,onChanged:(x,j)=>{var w;(w=e.onTranslationXChanged)==null||w.call(e,.5*x/A,.5*j/A)},onIntermediateChanged:(x,j)=>{var w;(w=e.onTranslationXIntermediateChanged)==null||w.call(e,.5*x/A,.5*j/A)},threshold:0,displayMode:r,verticalSeparator:b,disabled:!s}),i.jsx("compareMaterial",{attach:"material",ref:n,vertexShader:Be,fragmentShader:L},F)]})}function D(e,n,r,c){if(n===r)return e;if(n==="rad"&&r==="deg")return 180*e/Math.PI;if(n==="deg"&&r==="rad")return Math.PI*e/180;if(n==="px"){if(c!==void 0){const t=c.to("mm").scalar;return D(e*t,"mm",r,void 0)}return Number.NaN}if(r==="px"){if(c!==void 0){const t=D(e,n,"mm",void 0),a=c.to("mm").scalar;return t/a}return Number.NaN}try{return ye(e,n).to(r).scalar}catch{return console.error(`Convertion ${n}->${r} is not provided`),Number.NaN}}function He(e){return e==="um"?"μm":e}function en(e){const{style:n,className:r,decimals:c=2}=e,t=m.useRef(null),a=m.useRef(void 0),[f,l]=m.useState(!1),u=m.useMemo(()=>e.preferedDisplayUnit!==void 0&&(e.pixelSize===void 0||e.unit==="px"||e.preferedDisplayUnit==="px")?e.preferedDisplayUnit:e.displayUnit??e.unit,[e.displayUnit,e.unit,e.preferedDisplayUnit,e.pixelSize]),d=m.useCallback(o=>{if(!(o===void 0||u===void 0))return D(o,u,e.unit,e.pixelSize)},[e.unit,u,e.pixelSize]),v=m.useCallback(o=>{if(!(o===void 0||u===void 0))return D(o,e.unit,u,e.pixelSize)},[e.unit,u,e.pixelSize]);function b(){var S;if(a.current===void 0)return;const o=a.current,s=d(o);a.current=void 0,t.current&&(t.current.value=o.toFixed(c)),s!==void 0&&((S=e.onChange)==null||S.call(e,s)),l(!1)}function _(){var o;a.current!==void 0&&(a.current=void 0,t.current&&(t.current.value=((o=v(e.value))==null?void 0:o.toFixed(c))??""),l(!1))}return m.useEffect(()=>{var o;a.current||t.current&&(t.current.value=((o=v(e.value))==null?void 0:o.toFixed(c))??"")},[e.value]),i.jsxs(Y,{className:r,style:n,children:[i.jsx(oe.Control,{ref:t,step:e.step,type:"number",style:{backgroundColor:f?"#FFFF80":"transparent"},onChange:o=>{l(!0),a.current=Number.parseFloat(o.target.value)},onBlur:()=>{_()},onKeyDown:o=>/^[ a-z]$/i.test(o.key)?(o.preventDefault(),!1):(o.stopPropagation(),o.key==="Enter"&&b(),!0)}),i.jsx(Y.Text,{children:He(u)})]})}function nn(e){const{geometry:n,lineWidth:r=2,color:c="blue",opacity:t=1,zIndex:a=1,visible:f=!0,readOnly:l=e.onGeometryChanged===void 0}=e,[u,d]=m.useState(!1);return f?i.jsxs("group",{position:[0,n.y,a],children:[i.jsx($,{children:i.jsx(ie,{pos:[0,n.y],size:[999999,Ne],pointer:"ns-resize",zIndex:a+Ae,enabled:!l,onPositionChanged:(v,b)=>{var _;(_=e.onGeometryChanged)==null||_.call(e,{y:v[1]},b)},onEnter:()=>{d(!0)},onLeave:()=>{d(!1)}})}),i.jsx("group",{children:i.jsx($,{children:i.jsxs("mesh",{children:[i.jsx("ambientLight",{}),i.jsx("planeGeometry",{attach:"geometry",args:[999999,u?Re:r,1,1]}),i.jsx("meshBasicMaterial",{attach:"material",transparent:!0,color:c,opacity:t})]})})})]}):i.jsx(i.Fragment,{})}function tn(e){const{as:n,onSelect:r,value:c}=e;function t(l){const{name:u}=P[l],d=l===O.NONE?"fa fa-fw fa-xmark":c===l?"fa fa-fw fa-circle-dot":"fa fa-fw fa-circle";return i.jsxs(Ce.Item,{eventKey:l,onClick:()=>{r(l)},children:[i.jsx("i",{className:d})," ",u]})}const{name:a}=P[c],f=c===O.NONE?"Apply a convolution filter":`Filter ${a} enabled`;return i.jsxs(Ie,{variant:c!==O.NONE?"primary":"secondary",as:n,title:i.jsx("i",{title:f,className:"fa fa-filter fa-fw fa-lg"}),id:"bg-vertical-dropdown-6",children:[t(O.NONE),t(O.LAPLACIAN_3x3),t(O.LAPLACIAN_9x9),t(O.SHARPENING_3x3),t(O.UNSHARPENING_3x3),t(O.UNSHARPENING_5x5),t(O.SMOOTH_3x3),t(O.SMOOTH_5x5),t(O.SMOOTH_7x7)]})}function an(e){const{value:n,range:r,step:c,title:t}=e,a=m.useRef({value:0,dragging:!1}),[f,l]=m.useState(void 0),u=f??n;return i.jsx(oe.Range,{min:u===void 0?u:u-r*.5,max:u===void 0?u:u+r*.5,value:n,title:t,step:c,onChange:d=>{var b,_;if(f===void 0)return;const v=Number.parseFloat(d.target.value);a.current.value=v,a.current.dragging?(b=e.onIntermediateChange)==null||b.call(e,v):(_=e.onChange)==null||_.call(e,v)},onMouseDown:d=>{l(n),a.current.dragging=!0},onMouseUp:d=>{var v;l(void 0),a.current.dragging=!1,(v=e.onChange)==null||v.call(e,a.current.value)}})}function rn(e){const{updateRoi:n,tiltRad:r,lateralMM:c,pixelSize:t}=e,a=X(r),f=(t==null?void 0:t.scalar)??1,l=c,u=X(l),d=X(f);function v(o,s,S){if(o===void 0)return;const{x11:F,y11:B,x12:A,y12:L,x21:E,y21:R,x22:T,y22:I}=o,y=S/s;return{x11:F*y,y11:B*y,x12:A*y,y12:L*y,x21:E*y,y21:R*y,x22:T*y,y22:I*y}}function b(o,s){if(o===void 0)return;const{x11:S,y11:F,x12:B,y12:A,x21:L,y21:E,x22:R,y22:T}=o;function I(h,N,x){const j=Math.cos(x),w=Math.sin(x);return[h*j-N*w,h*w+N*j]}const y=I(S,F,s),g=I(B,A,s),C=I(L,E,-s),z=I(R,T,-s);return{x11:y[0],y11:y[1],x12:g[0],y12:g[1],x21:C[0],y21:C[1],x22:z[0],y22:z[1]}}function _(o,s){if(o===void 0)return;const{x11:S,x12:F,x21:B,x22:A}=o;return{...o,x11:S-s,x12:F-s,x21:B+s,x22:A+s}}m.useMemo(()=>{a!==void 0&&r!==a&&n(o=>b(o,r-a))},[r,a,n]),m.useMemo(()=>{u!==void 0&&l!==u&&n(o=>_(o,l-u))},[l,u,n]),m.useMemo(()=>{d!==void 0&&f!==d&&n(o=>v(o,d,f))},[f,d,n])}function on(e){const{updateRoi:n,pixelSize:r}=e,c=(r==null?void 0:r.scalar)??1,t=X(c);function a(f,l,u){if(f===void 0)return;const{x1:d,y1:v,x2:b,y2:_}=f,o=u/l;return{x1:d*o,y1:v*o,x2:b*o,y2:_*o}}m.useMemo(()=>{t!==void 0&&c!==t&&n(f=>a(f,t,c))},[c,t,n])}class Ue extends re{constructor(){super({uniforms:{color:{value:new Se},lineWidth:{value:0},sizeInScreen:{value:0},angle:{value:0}},vertexShader:`
|
|
440
|
+
out vec2 pixelCoord;
|
|
441
|
+
|
|
442
|
+
void main() {
|
|
443
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
444
|
+
pixelCoord = vec2(position.x, position.y);
|
|
445
|
+
}
|
|
446
|
+
`,fragmentShader:`
|
|
447
|
+
// Based on antialiased arrow fields
|
|
448
|
+
// Nicolas P. Rougier (http://www.loria.fr/~rougier)
|
|
449
|
+
// https://www.shadertoy.com/view/ldlSWj
|
|
450
|
+
// Released under BSD license.
|
|
451
|
+
|
|
452
|
+
uniform vec4 color;
|
|
453
|
+
uniform float lineWidth;
|
|
454
|
+
uniform float sizeInScreen;
|
|
455
|
+
uniform float angle;
|
|
456
|
+
in vec2 pixelCoord;
|
|
457
|
+
|
|
458
|
+
// Computes the signed distance from a line
|
|
459
|
+
float sdf_line(vec2 p, vec2 p1, vec2 p2) {
|
|
460
|
+
vec2 center = (p1 + p2) * 0.5;
|
|
461
|
+
float len = length(p2 - p1);
|
|
462
|
+
vec2 dir = (p2 - p1) / len;
|
|
463
|
+
vec2 rel_p = p - center;
|
|
464
|
+
return dot(rel_p, vec2(dir.y, -dir.x));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Computes the signed distance from a line segment
|
|
468
|
+
float sdf_segment(vec2 p, vec2 p1, vec2 p2) {
|
|
469
|
+
vec2 center = (p1 + p2) * 0.5;
|
|
470
|
+
float len = length(p2 - p1);
|
|
471
|
+
vec2 dir = (p2 - p1) / len;
|
|
472
|
+
vec2 rel_p = p - center;
|
|
473
|
+
float dist1 = abs(dot(rel_p, vec2(dir.y, -dir.x)));
|
|
474
|
+
float dist2 = abs(dot(rel_p, dir)) - 0.5*len;
|
|
475
|
+
return max(dist1, dist2);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
float sdf_arrow(vec2 texcoord,
|
|
479
|
+
float body, float head, float height,
|
|
480
|
+
float linewidth, float antialias
|
|
481
|
+
) {
|
|
482
|
+
float d;
|
|
483
|
+
float w = linewidth/2.0 + antialias;
|
|
484
|
+
vec2 start = -vec2(body, 0.0);
|
|
485
|
+
vec2 end = +vec2(0.0, 0.0);
|
|
486
|
+
|
|
487
|
+
// Arrow tip (beyond segment end)
|
|
488
|
+
if( texcoord.x > body / 2.0) {
|
|
489
|
+
// Head : 2 segments
|
|
490
|
+
float d1 = sdf_line(texcoord, end, end - head*vec2(+1.0, -height));
|
|
491
|
+
float d2 = sdf_line(texcoord, end - head*vec2(+1.0, +height), end);
|
|
492
|
+
d = max(d1, d2);
|
|
493
|
+
} else {
|
|
494
|
+
// Head : 2 segments
|
|
495
|
+
float d1 = sdf_segment(texcoord, end - head * vec2(+1.0, -height), end);
|
|
496
|
+
float d2 = sdf_segment(texcoord, end - head * vec2(+1.0, +height), end);
|
|
497
|
+
d = min(d1, d2);
|
|
498
|
+
}
|
|
499
|
+
return d;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
vec4 filled(float distance, float linewidth, float antialias, vec4 fill)
|
|
503
|
+
{
|
|
504
|
+
vec4 frag_color;
|
|
505
|
+
float t = linewidth / 2.0 - antialias;
|
|
506
|
+
float signed_distance = distance;
|
|
507
|
+
float border_distance = abs(signed_distance) - t;
|
|
508
|
+
float alpha = border_distance / antialias;
|
|
509
|
+
alpha = exp(-alpha * alpha);
|
|
510
|
+
|
|
511
|
+
// Within linestroke
|
|
512
|
+
if (border_distance < 0.0) {
|
|
513
|
+
return fill;
|
|
514
|
+
}
|
|
515
|
+
// Within shape
|
|
516
|
+
if (signed_distance < 0.0) {
|
|
517
|
+
return fill;
|
|
518
|
+
}
|
|
519
|
+
// Outside shape
|
|
520
|
+
if (border_distance > (linewidth / 2.0 + antialias)) {
|
|
521
|
+
discard;
|
|
522
|
+
}
|
|
523
|
+
// Line stroke exterior border
|
|
524
|
+
return vec4(fill.rgb, alpha);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
void main() {
|
|
528
|
+
const float M_PI = 3.1415926535897932384626433832795;
|
|
529
|
+
|
|
530
|
+
float theta = angle * M_PI / 180.0;
|
|
531
|
+
float cos_theta = cos(theta);
|
|
532
|
+
float sin_theta = sin(theta);
|
|
533
|
+
vec2 pixelCoord2 = vec2(
|
|
534
|
+
cos_theta * pixelCoord.x - sin_theta * pixelCoord.y,
|
|
535
|
+
sin_theta * pixelCoord.x + cos_theta * pixelCoord.y
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
const float antialias = 1.0;
|
|
539
|
+
float body = sizeInScreen;
|
|
540
|
+
float d = sdf_arrow(pixelCoord2, body, 0.3 * body, 0.8, lineWidth, antialias);
|
|
541
|
+
gl_FragColor = filled(d, lineWidth, antialias, color);
|
|
542
|
+
}
|
|
543
|
+
`})}}ae({ArrowHeadMarkerMaterial:Ue});function G(e){const{x:n,y:r,color:c="black",opacity:t,sizeInScreen:a,angle:f,lineWidth:l=1,zIndex:u=0}=e,d=m.useRef(null);return m.useEffect(()=>{const v=Te(c,t);if(d.current){const b=d.current.uniforms;b.color.value=v,b.lineWidth.value=l,b.sizeInScreen.value=a,b.angle.value=f,H()}},[c,t,l,a,f]),i.jsx("group",{position:[n,r,u],children:i.jsx($,{screenDirection:!1,children:i.jsxs("mesh",{children:[i.jsx("ambientLight",{}),i.jsx("planeGeometry",{attach:"geometry",args:[a+l,a+l,1,1]}),i.jsx("arrowHeadMarkerMaterial",{attach:"material",transparent:!0,ref:d})]})})})}function te(e,n){return{x1:e.x,y1:e.y,x2:n.x,y2:n.y}}function cn(e){const{enabled:n=!0,setIntermediateRoi:r,setRoi:c}=e,t=Oe();return i.jsx(ze,{id:"selection-tool-rect",disabled:!n,onSelectionChange:a=>{if(a===void 0)return;const f=te(a.data[0],a.data[1]);r==null||r(f)},onSelectionStart:()=>{t==null||t.actions.captureMouseInteraction()},onSelectionEnd:()=>{t==null||t.actions.releaseMouseInteraction()},onValidSelection:a=>{const f=te(a.data[0],a.data[1]);c(f)},children:a=>i.jsx(i.Fragment,{})})}function ln(e){const{geometry:n,lineWidth:r=2,color:c="blue",opacity:t=1,zIndex:a=1,visible:f=!0,readOnly:l=e.onGeometryChanged===void 0}=e,u=e.unit===void 0?"":` ${e.unit}`;if(!f)return i.jsx(i.Fragment,{});const d=n.x1<n.x2==n.y1<n.y2,v=d?"nesw-resize":"nwse-resize",b=d?"nwse-resize":"nesw-resize";function _(g,C){var N;const{x:z,y:h}=g;(N=e.onGeometryChanged)==null||N.call(e,{...n,x1:z,y1:h},C)}function o(g,C){var N;const{x:z,y:h}=g;(N=e.onGeometryChanged)==null||N.call(e,{...n,x1:z,y2:h},C)}function s(g,C){var N;const{x:z,y:h}=g;(N=e.onGeometryChanged)==null||N.call(e,{...n,x2:z,y1:h},C)}function S(g,C){var N;const{x:z,y:h}=g;(N=e.onGeometryChanged)==null||N.call(e,{...n,x2:z,y2:h},C)}function F(g,C){var h;const{x:z}=g;(h=e.onGeometryChanged)==null||h.call(e,{...n,x1:z},C)}function B(g,C){var h;const{x:z}=g;(h=e.onGeometryChanged)==null||h.call(e,{...n,x2:z},C)}function A(g,C){var h;const{y:z}=g;(h=e.onGeometryChanged)==null||h.call(e,{...n,y1:z},C)}function L(g,C){var h;const{y:z}=g;(h=e.onGeometryChanged)==null||h.call(e,{...n,y2:z},C)}function E(g,C){var j;const{x1:z,x2:h,y1:N,y2:x}=n;(j=e.onGeometryChanged)==null||j.call(e,{x1:g[0],y1:g[1],x2:g[0]+(h-z),y2:g[1]+(x-N)},C)}const R=(n.x1+n.x2)*.5,T=(n.y1+n.y2)*.5,I=Math.abs(n.x1-n.x2),y=Math.abs(n.y1-n.y2);return i.jsxs(i.Fragment,{children:[i.jsx(ie,{pos:[n.x1,n.y1],displayPos:[R,T],size:[I,y],pointer:"move",zIndex:a,enabled:!l,onPositionChanged:E}),i.jsx(J,{geometry:{y:n.y1,x1:n.x1,x2:n.x2},zIndex:a,color:c,opacity:t,readOnly:l,lineWidth:r,onGeometryChanged:A}),i.jsx(G,{zIndex:a,sizeInScreen:M,lineWidth:r,x:R-I*.5,y:T-y*.5,angle:180,color:c,opacity:t}),i.jsx(G,{zIndex:a,sizeInScreen:M,lineWidth:r,x:R+I*.5,y:T-y*.5,angle:0,color:c,opacity:t}),i.jsx(G,{zIndex:a,sizeInScreen:M,lineWidth:r,x:R-I*.5,y:T-y*.5,angle:90,color:c,opacity:t}),i.jsx(G,{zIndex:a,sizeInScreen:M,lineWidth:r,x:R-I*.5,y:T+y*.5,angle:270,color:c,opacity:t}),i.jsx(J,{geometry:{y:n.y2,x1:n.x1,x2:n.x2},zIndex:a,color:c,opacity:t,readOnly:l,lineWidth:r,onGeometryChanged:L}),i.jsx(K,{geometry:{x:n.x1,y1:n.y1,y2:n.y2},zIndex:a,color:c,opacity:t,readOnly:l,lineWidth:r,onGeometryChanged:F}),i.jsx(K,{geometry:{x:n.x2,y1:n.y1,y2:n.y2},zIndex:a,color:c,opacity:t,readOnly:l,lineWidth:r,onGeometryChanged:B}),i.jsx(p,{text:`${I.toFixed(2)}${u}`,datapos:[R,T-y*.5],anchor:"top",vmargin:5,outline:"#FFFFFF80"}),i.jsx(p,{text:`${y.toFixed(2)}${u}`,datapos:[R-I*.5,T],anchor:"right",hmargin:5,outline:"#FFFFFF80"}),!l&&i.jsxs(i.Fragment,{children:[i.jsx(k,{geometry:{x:n.x1,y:n.y1},pointer:v,zIndex:a,color:c,opacity:t,readOnly:l,onGeometryChanged:_}),i.jsx(k,{geometry:{x:n.x1,y:n.y2},pointer:b,zIndex:a,color:c,opacity:t,readOnly:l,onGeometryChanged:o}),i.jsx(k,{geometry:{x:n.x2,y:n.y1},pointer:b,zIndex:a,color:c,opacity:t,readOnly:l,onGeometryChanged:s}),i.jsx(k,{geometry:{x:n.x2,y:n.y2},pointer:v,zIndex:a,color:c,opacity:t,readOnly:l,onGeometryChanged:S})]})]})}export{G as A,pe as C,Le as D,O as F,nn as H,en as I,ln as R,on as a,tn as b,cn as c,an as d,X as e,rn as u};
|