-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17553 from davelopez/add_tiff_visualization
Add basic TIFF Image visualization
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
config/plugins/visualizations/tiffviewer/config/tiffviewer.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE visualization SYSTEM "../../visualization.dtd"> | ||
<visualization name="Tiff Viewer"> | ||
<description>Basic Tiff Image visualization</description> | ||
<data_sources> | ||
<data_source> | ||
<model_class>HistoryDatasetAssociation</model_class> | ||
|
||
<test type="isinstance" test_attr="datatype" result_type="datatype">images.Tiff</test> | ||
|
||
<to_param param_attr="id">dataset_id</to_param> | ||
</data_source> | ||
</data_sources> | ||
<params> | ||
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param> | ||
</params> | ||
<entry_point entry_point_type="chart" src="script.js" css="script.css"/> | ||
</visualization> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "tiff-visualization", | ||
"version": "0.1.0", | ||
"description": "A visualization for Tiff files based on react-tiff package", | ||
"keywords": [ | ||
"galaxy", | ||
"visualization", | ||
"Tiff" | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"react-tiff": "^0.0.8" | ||
}, | ||
"scripts": { | ||
"build": "parcel build src/script.js --dist-dir static" | ||
}, | ||
"devDependencies": { | ||
"buffer": "^5.5.0||^6.0.0", | ||
"parcel": "^2.9.3", | ||
"process": "^0.11.10" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { StrictMode } from "react"; | ||
|
||
import { TIFFViewer } from "react-tiff"; | ||
import { createRoot } from "react-dom/client"; | ||
import "react-tiff/dist/index.css"; | ||
|
||
const App = (props) => { | ||
return <TIFFViewer tiff={props.dataset_url} paginate="bottom" />; | ||
}; | ||
|
||
/* This will be part of the charts/viz standard lib in 23.1 */ | ||
const slashCleanup = /(\/)+/g; | ||
function prefixedDownloadUrl(root, path) { | ||
return `${root}/${path}`.replace(slashCleanup, "/"); | ||
} | ||
|
||
window.bundleEntries = window.bundleEntries || {}; | ||
window.bundleEntries.load = function (options) { | ||
const dataset = options.dataset; | ||
const url = prefixedDownloadUrl(options.root, dataset.download_url); | ||
const root = createRoot(document.getElementById(options.target)); | ||
root.render( | ||
<StrictMode> | ||
<App dataset_url={url} /> | ||
</StrictMode> | ||
); | ||
options.chart.state("ok", "Done."); | ||
options.process.resolve(); | ||
}; |