# Paraview Glance - loading multiple files

**URL:** https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238
**Category:** Web Support
**Created:** [May 1, 2020, 10:13pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238 "2020-05-01T22:13:15Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 1, 2020, 10:13pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/1 "2020-05-01T22:13:15Z")

</div>

Hi,

I am customizing PV Glance to add to our app, something that we struggle with is to load multiple datasets with different color maps pre-set at load.  
We were able to add custom features inside the code that we can change the colormap during load, but how can we pass multiple files with different settings to the app?

Thanks

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [May 2, 2020, 9:30am UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/2 "2020-05-02T09:30:51Z")

</div>

The way to go is to load a single \*.glance file that can refer to other remote dataset while enabling to configure any rendering settings, color, representations and views…

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 2, 2020, 1:29pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/3 "2020-05-02T13:29:51Z")

</div>

Sebastien,

Thank you so much for the response. I’ve spent last a few days trying to figure out the structure of the glance file but I couldnt find any reference. Can you please share a resource to help me build the glance file inside my python code? Because we need to build that inside our code.  
Thanks

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [May 4, 2020, 9:06am UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/4 "2020-05-04T09:06:52Z")

</div>

The way to go is to load 1 remote dataset, tune the UI the way you want and save the state (\*.glance) file.  
At that point, you unzip that glance file and look at the JSON structure of the file. That file should be fairly simple to follow. And from your learning, you should be able to add as many remote dataset as you want with all the required tuning you may be looking for. You can always start with the glance files available [here](https://github.com/Kitware/paraview-glance/tree/master/data).

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 4, 2020, 12:28pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/5 "2020-05-04T12:28:00Z")

</div>

Sebastien,

Thank you so much, this is exactly what I was looking for. Using this template I can easily change the UI setting, now the question would be can I give nii.gz url inside this JSON or should I put the vtk array in it directly? If I can just put url in it, can you please provide an example. All examples you have are using Girder to load file, I am trying to load file from source directly.

Thanks for the help

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [May 4, 2020, 12:55pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/6 "2020-05-04T12:55:30Z")

</div>

Just the url. Girder is still using just a url that looks weird, but it is still just a url for an HTTP Get request.

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [May 4, 2020, 12:56pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/7 "2020-05-04T12:56:42Z")

</div>

What do you mean by `loading file from source`? Since you are on the web, you need to be able to download your file from a URL.

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 4, 2020, 1:37pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/9 "2020-05-04T13:37:07Z")

</div>

I meant URL, I think I got it, thank you so much, I will let you know if I have any difficulties

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 4, 2020, 2:31pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/10 "2020-05-04T14:31:54Z")

</div>

Sebastian,

I’ve edited the source section of the JSON file into the following:  
“sources”:  
[  
{  
“id”:“6”,  
“group”:“Sources”,  
“name”:“TrivialProducer”,  
“props”:  
{  
“name”:“headAndNeck-HybridPrediction.nii”,  
“type”:“vtkImageData”,  
“dataset”:  
{  
“serializedType”:“girder”,  
“provenance”:  
{  
“description”:"",  
“meta”:{},  
“name”:“Girder COVID19 Demo”,  
“public”:true,  
“notPublic”:false,  
“apiRoot”:"~/GIT/pv-glance/static/"  
},  
“item”:  
{  
“itemName”:“headAndNeck-HybridPrediction.nii”  
},  
“meta”:{}  
}  
}  
}  
],

And I am getting the following error: Uncaught TypeError: source.getDataset(…).isA is not a function

Any ideas what’s my mistake?

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [May 4, 2020, 2:41pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/11 "2020-05-04T14:41:41Z")

</div>

It should be simpler than that. Load an external file using url and save a glance file. At that point the data does-not come from Girder and you will see how the url get used.

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 4, 2020, 2:54pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/12 "2020-05-04T14:54:29Z")

</div>

That’s my problem, when I am using url and save the state file, the entire file is paste there as vtk array. Basically the glance file, becomes a vtk array + UI settings.

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [May 4, 2020, 5:08pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/13 "2020-05-04T17:08:43Z")

</div>

@Forrest_Li it seems that a bug got introduced as the remote nature of the data was not kept like it use to in the glance output.

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [May 4, 2020, 5:43pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/14 "2020-05-04T17:43:05Z")

</div>

I don’t know if it still works but downloading an old glance file from `v3.0.0`, I found

```auto
    "sources": [
        {
            "id": "3",
            "props": {
                "name": "f1.obz",
                "dataset": {
                    "name": "f1.obz",
                    "url": "https://kitware.github.io/vtk-js-datasets/data/obj-mtl/Ferrari%20F1.zip"
                }
            }
        }
    ],

```

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 4, 2020, 6:10pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/15 "2020-05-04T18:10:30Z")

</div>

[state.json](https://discourse.paraview.org/uploads/short-url/bj1LgbqSiRt683tyHbmPpt1qDJS.json) (5.3 KB)

This is what I’ve wrote based on combination of COVID example and your code. I am still getting the same error:

Uncaught TypeError: source.getDataset(…).isA is not a function

```auto

```

---

<div class="post-metadata">

### Author: ![Forrest\_Li](https://discourse.paraview.org/user_avatar/discourse.paraview.org/forrest_li/32/1935_2.png) [@Forrest\_Li](https://discourse.paraview.org/u/Forrest_Li)
#### Post date: [May 4, 2020, 6:16pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/16 "2020-05-04T18:16:50Z")

</div>

Verified the remote bug. I’ve pushed a PR to fix it: [https://github.com/Kitware/paraview-glance/pull/331](https://github.com/Kitware/paraview-glance/pull/331)

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 4, 2020, 6:17pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/17 "2020-05-04T18:17:47Z")

</div>

Thanks guys for the great help.

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 4, 2020, 8:20pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/18 "2020-05-04T20:20:16Z")

</div>

After a lot of different tries, I am still getting the glance file.

---

<div class="post-metadata">

### Author: ![Forrest\_Li](https://discourse.paraview.org/user_avatar/discourse.paraview.org/forrest_li/32/1935_2.png) [@Forrest\_Li](https://discourse.paraview.org/u/Forrest_Li)
#### Post date: [May 4, 2020, 8:35pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/19 "2020-05-04T20:35:15Z")

</div>

Are you still trying the state.json file you’ve attached in your previous post? Or are you re-generating your glance file via the save state button? if you’re using your aforementioned state.json file, you need to modify your sources object like so:

```auto
"id": "6",                 
"group": "Sources",        
"name": "TrivialProducer", 
"props": {                 
    "name": "test.nii",    
    "type": "vtkImageData",
    "dataset": {           
        "name": "test.nii",
        "url": "....."
    }                      

```

Easiest way is to still re-generate the glance file.

---

<div class="post-metadata">

### Author: ![alib022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@alib022](https://discourse.paraview.org/u/alib022)
#### Post date: [May 4, 2020, 8:40pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/20 "2020-05-04T20:40:51Z")

</div>

No I regenerated from a new installation. Basically I re-built the code on my computer and trying to export, gives me the same file as before. I made sure that I have the latest version as well.

---

<div class="post-metadata">

### Author: ![Forrest\_Li](https://discourse.paraview.org/user_avatar/discourse.paraview.org/forrest_li/32/1935_2.png) [@Forrest\_Li](https://discourse.paraview.org/u/Forrest_Li)
#### Post date: [May 4, 2020, 9:03pm UTC](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238/21 "2020-05-04T21:03:05Z")

</div>

It works for me when I use this URL: [https://localhost:9999/?name=head-mr.vti&url=https://kitware.github.io/vtk-js-datasets/data/vti/head-binary-zlib.vti](https://localhost:9999/?name=head-mr.vti&url=https://kitware.github.io/vtk-js-datasets/data/vti/head-binary-zlib.vti)

I load it, save state, then I can load the resulting glance file and the dataset shows up. Can you provide more details as to what is the error you get now, if it’s different from before?

[Next page](https://discourse.paraview.org/t/paraview-glance-loading-multiple-files/4238.md?page=2)
