Repository navigation
Expand file tree
/
Copy pathdetail.html
More file actions
146 lines (131 loc) · 5.13 KB
/
Copy pathdetail.html
File metadata and controls
146 lines (131 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dataset Evaluation</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<header>
<nav>
<a href="index.html">Home</a>
<a href="brain.html">Brain</a>
<a href="cancer.html">Cancer</a>
<a href="organs.html">Organs</a>
<a href="domain.html">Domain</a>
</nav>
<h1>Dataset Evaluation</h1>
</header>
<main id="detail-container">
<p id="loading">Loading dataset...</p>
</main>
<script>
const container = document.getElementById("detail-container");
const loadingText = document.getElementById("loading");
// Get dataset title from URL parameter
const params = new URLSearchParams(window.location.search);
const datasetTitle = params.get('dataset');
if (!datasetTitle) {
loadingText.textContent = "❌ No dataset specified.";
} else {
// Determine which JSON file to load based on current page
const pageType = params.get('type') || 'brain';
fetch(`datasets/${pageType}.json`)
.then(res => {
if (!res.ok) throw new Error(`Failed to load ${pageType}.json`);
return res.json();
})
.then(data => {
// Find the dataset matching the title
const dataset = data.find(d => d.title === decodeURIComponent(datasetTitle));
if (!dataset) {
loadingText.textContent = "❌ Dataset not found.";
return;
}
loadingText.remove();
// If this is a domain type, show only the evaluation image
if (pageType && pageType.startsWith('domain')) {
const title = document.createElement('h1');
title.textContent = dataset.title;
container.appendChild(title);
const evalDiv = document.createElement('div');
evalDiv.className = 'comparison-item';
const evalSrc = dataset.image.replace(/(\.[a-zA-Z0-9]+)$/, '_eval$1');
evalDiv.innerHTML = `
<h2>Evaluation</h2>
<div class="heatmap-with-legend">
<img src="${evalSrc}" alt="${dataset.title} - Evaluation" class="main-heatmap">
</div>
`;
container.appendChild(evalDiv);
const backBtn = document.createElement('a');
backBtn.href = 'domain.html';
backBtn.className = 'back-btn';
backBtn.textContent = '← Back';
container.appendChild(backBtn);
} else {
// ===== RAW HEATMAP =====
const origDiv = document.createElement('div');
origDiv.className = 'comparison-item';
const heatmapSrc = dataset.image.replace(/(\.[a-zA-Z0-9]+)$/, '_heatmap$1');
const heatmapLegendSrc = 'assets/images/heatmap_legend.png';
origDiv.innerHTML = `
<h2>Heatmap</h2>
<div class="heatmap-with-legend">
<img src="${heatmapSrc}" alt="${dataset.title} - Heatmap" class="main-heatmap">
</div>
`;
// ===== FUNKY HEATMAP =====
const funkySrc = dataset.image.replace(/(\.[a-zA-Z0-9]+)$/, '_funky$1');
console.log('Heatmap image:', heatmapSrc);
console.log('Funky Heatmap image:', funkySrc);
const heatDiv = document.createElement('div');
heatDiv.className = 'comparison-item';
heatDiv.innerHTML = `
<h2>Funky Heatmap</h2>
<img src="${funkySrc}"
alt="${dataset.title} - Heatmap"
class="heatmap-img"
onerror="console.error('Failed to load heatmap:', this.src)">
`;
// ===== BIVARIATE PLOT =====
const bivariateSrc = dataset.image.replace(/(\.[a-zA-Z0-9]+)$/, '_bivariate$1');
const bivarDiv = document.createElement('div');
bivarDiv.className = 'comparison-item';
bivarDiv.innerHTML = `
<h2>Bivariate Plot</h2>
<div class="heatmap-with-legend">
<img src="${bivariateSrc}"
alt="${dataset.title} - Bivariate"
class="main-heatmap bivariate-img"
onerror="console.warn('No bivariate image for:', this.src)">
<img src="${heatmapLegendSrc}" alt="Legend" class="heatmap-legend">
</div>
`;
// Add title and metadata
const title = document.createElement('h1');
title.textContent = dataset.title;
container.appendChild(title);
// STACKED layout (funky first, then a row with raw heatmap + bivariate)
container.appendChild(heatDiv);
const row = document.createElement('div');
row.className = 'comparison';
row.appendChild(origDiv);
row.appendChild(bivarDiv);
container.appendChild(row);
// Add back button
const backBtn = document.createElement('a');
backBtn.href = pageType + '.html';
backBtn.className = 'back-btn';
backBtn.textContent = '← Back';
container.appendChild(backBtn);
}
})
.catch(err => {
loadingText.textContent = "⚠️ Could not load dataset.";
console.error(err);
});
}
</script>
</body>
</html>