What about loading All dic images in cache and displaying simultaneously in viewports

420 views
Skip to first unread message

Nikhil Ghuse

unread,
Dec 7, 2016, 1:33:35 AM12/7/16
to cornerstone platform
Hello all,
             I have been trying to implement web workers for Image Viewer to load and cache all images at one instant and then display in available view-ports.
Actually I have implemented it by finding all images from stack and looping and caching them but it takes much time and become unresponsive.

Chris Hafey

unread,
Dec 7, 2016, 9:10:37 AM12/7/16
to cornerstone platform
The dev branch of cornerstoneWADOImageLoader has support for decoding in web workers - have you tried that?

Nikhil Ghuse

unread,
Dec 9, 2016, 2:19:51 AM12/9/16
to cornerstone platform
yes I have gone through it... Actually I have implemented it completely but if there are images more than 1000 gets crash...

reference 'cornerstonewadoimageloaderwebworker'

if (signed) {
        "if(Int16Array.from) {
          image.pixelData = Int16Array.from(src32);"
        } else {
          image.pixelData = new Int16Array(length);
          for(var i=0; i < length; i++) {
            image.pixelData[i] = src32[i];
          }
        }
      } else {
        if(Uint16Array.from) {
          "image.pixelData = Uint16Array.from(src32);"
        } else {
          image.pixelData = new Uint16Array(length);
          for(var i=0; i < length; i++) {
            image.pixelData[i] = src32[i];
          }
        }

And error generated in double quoted lines...

Chris Hafey

unread,
Dec 10, 2016, 11:58:37 AM12/10/16
to cornerstone platform
The code snippet you linked appears to be from the JPEG2000 decoder.  JPEG2000 decoding is very memory intensive and the line your get the error on has to do with memory allocation.  It may be that you are running out of memory, here are some things to try:
1) Use fewer web workers.  Each web worker consumes a lot of memory
2) Use another transfer syntax.  I would try explicit little endian, then jpeg lossless then jpeg-ls

Some questions for you:
How much RAM is on your computer?  
Are you using a 64 bit or 32 bit browser?  
Is the browser crashing or is an error displayed on the console?

Chris
Message has been deleted
Message has been deleted

Nikhil Ghuse

unread,
Dec 19, 2016, 5:01:33 AM12/19/16
to cornerstone platform
Hi Chris,
                 I have gone through your comment and what I have found is that you have suggested what I have already done...

1)Use less web workers
but I didn't get second point... 

And Following are those question which you want to know.

How much RAM is on your computer?  
- 4 GB
Are you using a 64 bit or 32 bit browser?  
-64 bit
Is the browser crashing or is an error displayed on the console?
-both error displayed in console then browser crash.

Chris Hafey

unread,
Dec 19, 2016, 8:25:36 AM12/19/16
to cornerstone platform
4GB may not be enough memory for decoding JPEG2000 images - see if your server can convert the images to another compression format.

Nikhil Ghuse

unread,
Dec 19, 2016, 9:22:51 AM12/19/16
to cornerstone platform
I don't want to change or convert images into other compression format. I need to use JPEG2000 only.


On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:

Chris Hafey

unread,
Dec 19, 2016, 9:28:45 AM12/19/16
to cornerstone platform
OK - not sure I can be of much more help then

Nikhil Ghuse

unread,
Dec 20, 2016, 4:57:01 AM12/20/16
to cornerstone platform
Is it possible or not...? 


On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:

Chris Hafey

unread,
Dec 20, 2016, 9:39:54 AM12/20/16
to cornerstone platform
Oh - did you try using the PDF.js codec?  Perhaps it will use less memory...

JF Pambrun

unread,
Dec 20, 2016, 9:52:16 AM12/20/16
to Chris Hafey, cornerstone platform
Does cornerstoneWADOImageLoader use the fixed or dynamic memory version of OpenJpeg-JS by default?

Looks like the fixed version is set to 4 GB (TOTAL_MEMORY=400000000).

JF

--
You received this message because you are subscribed to the Google Groups "cornerstone platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cornerstone-plat...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cornerstone-platform/633f739c-9e33-4f68-a77a-0d7dfc4a1e51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Hafey

unread,
Dec 20, 2016, 10:08:37 PM12/20/16
to cornerstone platform, cha...@gmail.com
It uses the fixed for higher performance.  Good idea to try using the dynamic (or build the fixed with a smaller memory size)


On Tuesday, December 20, 2016 at 8:52:16 AM UTC-6, Jean-Francois Pambrun wrote:
Does cornerstoneWADOImageLoader use the fixed or dynamic memory version of OpenJpeg-JS by default?

Looks like the fixed version is set to 4 GB (TOTAL_MEMORY=400000000).

JF

On Tue, Dec 20, 2016 at 9:39 AM Chris Hafey <cha...@gmail.com> wrote:
Oh - did you try using the PDF.js codec?  Perhaps it will use less memory...

On Tuesday, December 20, 2016 at 3:57:01 AM UTC-6, Nikhil Ghuse wrote:
Is it possible or not...? 

On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:
Hello all,
             I have been trying to implement web workers for Image Viewer to load and cache all images at one instant and then display in available view-ports.
Actually I have implemented it by finding all images from stack and looping and caching them but it takes much time and become unresponsive.

--
You received this message because you are subscribed to the Google Groups "cornerstone platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cornerstone-platform+unsub...@googlegroups.com.

Nikhil Ghuse

unread,
Dec 21, 2016, 5:13:35 AM12/21/16
to cornerstone platform
I have use PDF.js codec by usePDFJS = true  and tried Dynamic memory version in CornerStoneWADOLoaderCodecs but still the same issue occurs


On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:

Chris Hafey

unread,
Dec 21, 2016, 9:01:00 AM12/21/16
to cornerstone platform
I just loaded a 1000 slice JPEG2000 CT study in our viewer with one web worker and chrome is using 1.66GB of RAM.  When I use 8 web workers, it took up 3.8 GB of RAM.  This is on Mac OS X Sierra 10.12.2.  What you are doing should be possible.

Chris

Nikhil Ghuse

unread,
Dec 21, 2016, 9:53:10 AM12/21/16
to cornerstone platform
It works fine with mac OS i have loaded 6500 images with 4 web workers in Safari.. But when I tried the same with chrome and on Windows platform it gets crash before 1000 images and same happens with IPad but crash occurs before 100 images.

Nikhil  


On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:

Chris Hafey

unread,
Dec 21, 2016, 10:12:41 AM12/21/16
to cornerstone platform
I just tried our viewer on Windows 7 with chrome and it loaded all 1000 JPEG2000 CT images.  Perhaps the problem is in your code?

Nikhil Ghuse

unread,
Dec 22, 2016, 2:06:59 AM12/22/16
to cornerstone platform
hi chris,
             I have tried for 1000 and it works in Windows 7 and Chrome what about more than 1300 CT images try for it..


On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:

Nikhil Ghuse

unread,
Dec 22, 2016, 2:15:24 AM12/22/16
to cornerstone platform, cha...@gmail.com
I have change Fixed memory to dynamic in Codecs.


On Tuesday, December 20, 2016 at 8:22:16 PM UTC+5:30, Jean-Francois Pambrun wrote:
Does cornerstoneWADOImageLoader use the fixed or dynamic memory version of OpenJpeg-JS by default?

Looks like the fixed version is set to 4 GB (TOTAL_MEMORY=400000000).

JF

On Tue, Dec 20, 2016 at 9:39 AM Chris Hafey <cha...@gmail.com> wrote:
Oh - did you try using the PDF.js codec?  Perhaps it will use less memory...

On Tuesday, December 20, 2016 at 3:57:01 AM UTC-6, Nikhil Ghuse wrote:
Is it possible or not...? 

On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:
Hello all,
             I have been trying to implement web workers for Image Viewer to load and cache all images at one instant and then display in available view-ports.
Actually I have implemented it by finding all images from stack and looping and caching them but it takes much time and become unresponsive.

--
You received this message because you are subscribed to the Google Groups "cornerstone platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cornerstone-platform+unsub...@googlegroups.com.

Nikhil Ghuse

unread,
Dec 23, 2016, 1:03:22 AM12/23/16
to cornerstone platform
hi chris ,
              A simple question what does  lastCachedImage.imagePromise.reject(); means .?('cornerston.js [line no 526]')
             There isn't any method reject in ImagePromise.


On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:

idm...@gmail.com

unread,
Dec 23, 2016, 5:00:46 AM12/23/16
to cornerstone platform, cha...@gmail.com
Facing same issue on 32Bit windows with 4GB RAM using Chrome.
Where did you made those changes to allow dynamic memory allocation ?

Nikhil Ghuse

unread,
Dec 23, 2016, 5:10:12 AM12/23/16
to cornerstone platform, cha...@gmail.com
in CornerStoneWADOLoaderCodecs.js

Chris Hafey

unread,
Dec 23, 2016, 8:16:53 AM12/23/16
to cornerstone platform
Message has been deleted

Nikhil Ghuse

unread,
Dec 24, 2016, 12:39:56 AM12/24/16
to cornerstone platform



On Wednesday, December 7, 2016 at 12:03:35 PM UTC+5:30, Nikhil Ghuse wrote:

Nikhil Ghuse

unread,
Jun 22, 2017, 8:14:39 AM6/22/17
to cornerstone platform
Actually there isn't  lastCachedImage.imagePromise.reject(); so i have initialized $.deferred and assigned it to  lastCachedImage.imagePromise so that It can reject the imagepromise.
Reply all
Reply to author
Forward
0 new messages