GithubHelp home page GithubHelp logo

Comments (6)

dvenkatsagar avatar dvenkatsagar commented on August 16, 2024

Well, for now the only work around is to go for the traditional approach or use the module ndarrays.js to get things done.

    ...
    series.buildSeries();
    var r = series.images[0].getRows();
    var c = series.images[0].getCols();
    var no = series.images.length;

    var volume_buffer = new Array(no);
    var i = no, j = 0,k = 0;
    while(i--){
      var slice_buffer = series.images[j++].getInterpretedData(true);
      volume_buffer[j-1] = slice_buffer;
    }
    var slice = ndarray(new Float32Array(volume_buffer[115]),[r,c]);
    ...

The weird thing is that, if I try to convert all the images to a single Float32Array/Array like this :

    ...
    series.buildSeries();
    var r = series.images[0].getRows();
    var c = series.images[0].getCols();
    var no = series.images.length;

    var volume_buffer = new Array(r*c*no);
    var i = no, j = 0,k = 0;
    while(i--){
      var slice_buffer = series.images[j++].getInterpretedData(true);
      var l = slice_buffer.length, m = 0;
      while(l--){
        volume_buffer[k++] = slice_buffer[m++]; // A single stream
      }
    }
    var volume = ndarray(new Float32Array(volume_buffer),[r,c,no]);
    var slice = volume.pick(null,null,115);
    ...

The images dont show up correct. I dont know what I am doing wrong here.

from daikon.

rii-mango avatar rii-mango commented on August 16, 2024

Can you post a screenshot of what it looks like? Is it just noise or do you see some pattern?

from daikon.

dvenkatsagar avatar dvenkatsagar commented on August 16, 2024

It comes as a pattern i guess. Here is the link

from daikon.

rii-mango avatar rii-mango commented on August 16, 2024

Based on the image, it looks like somewhere the dimensions are wrong. Try swapping c and r? The data is usually ordered by column then row.

var volume = ndarray(new Float32Array(volume_buffer),[c,r,no]);

from daikon.

dvenkatsagar avatar dvenkatsagar commented on August 16, 2024

I think that wouldnt help as the ndarray.shape is a array. from the looks of it, the images are of size 512x512, so because of that, it will give the same result i guess.

from daikon.

dvenkatsagar avatar dvenkatsagar commented on August 16, 2024

Ok I was able to fix it.... it was the way the array is stored in the ndarray, i changed the order as [no,r,c] and it worked

from daikon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.