Pergunta

i have two volumes (.nrrd) of different qualities. the user can browse through the layers. if a key is pressed i want to load the slice of the volume with better quality.

my volume is similar to this one: lesson 10 xtk

i've found:

volume.children[2].children[0].children[0].texture.file = "http://path/to/file.ext";

but if i apply some kind of file (.jpg, .dcm) nothing happens.

is this the right approach to change the slice to go inside the children and change the texture?

or shall i load the selected slice seperate as an object and apply it to the "lower-quality-volume" somehow?


edit: this is what i tried so far (i get errors with dcms but not with jpgs):

if (event.keyCode == 83) {  // "s"-button
    volume.children[2].children[0].children[0].texture.file = "http://localhost:3000/112.jpg";
    volume.children[2].children[0].children[0].modified();
    r.render();
}

edit2: this is whats in my r.onShowtime = function() {}

volume.children[2].children[0].texture.file = 'http://localhost:3000/112.jpg';
volume.children[2].children[0].visible = true; // to activate the first layer
volume.children[2].children[0].modified();
console.log(volume.children[2].children[0].visible +" "+ volume.children[2].children[0].texture.file);

it outputs "true hostname/112.jpg"

when i inspect the .jpg in firebug the header is ok but the answer is "null"

when i inspect console.log(volume.children[2].children[0]); with firebug

.texture.file is set to hostname/112.jpg

when i go to "network" the .jpg has been transfered successfully

enter image description here

enter image description here


enter image description here

please notice that 112.jpg and level.jpg are the same. the first one is getting loaded in r.onShowtime and the other one is loaded at a keypressed event.


EDIT 3: volume.children[2].children[0] is of the type "X.slice", isn't it?

here is my approach: jsFiddle

and this is my actual issue and still not working: jsFiddle

Foi útil?

Solução

Mhh..

I think a call to object.modified() is missing in the file setter (and in others setters from inject classes). Let's see when Haehn will come if he wants to change something internaly, but for the moment could you try to call it by yourself ?

You can try to add after the modification of texture :

volume.children[2].children[0].children[0].modified();

And if it doesn't work, in addition :

renderer.render();

Edit : It's strange, I did a similar code and it did something. Can you please try something like that with opening your javascript console (Firefox, Chrome,... has one) and tell me the error you get ?

 renderer.onShowtime = {
   for (var i=0 ; i< volume.children[2].children.length ; i++) {
     volume.children[2].children[i].texture.file="myimage.jpeg";
     volume.children[2].children[i].modified();
   }
 }

It is important you call it in the onShowtime, because before the volume is not loaded, and so slicesX, slicesY... don't exist.

Edit2 : Hey,

Thanks to the informations you added I think I've got the point ! In the render() method of our renderer3D there is a test on texture._dirty flag, that you cannot change from outside the framework. In addition the 1st rendering with a texture make that flag false, and loading a new texture doesn't seem to set that flag back to true in the current XTK. So, I think, we have to add it in the loader.load(texture, object) method. I'll make an issue on Github and see what Haehn thinks of it !

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top