marcelvanherk / Conquest-DICOM-Server

Conquest DICOM server, aiming for complete source code release
112 stars 47 forks source link

WadoSeriesViewer fails sometimes getting WindowWidth and WindowCenter. #39

Closed lncoll closed 3 months ago

lncoll commented 3 months ago

Hi, I've noticed in wadoseriesviewer, windowwidth and windowcenter is set to 1000 when this info is not at the dicom object. Here I send you a proposal to correct this. Changes marked as lncoll. Hope is useful. Luis wadoseriesviewer.zip

marcelvanherk commented 3 months ago

Hi Luis,

I have merged it. Not sure why I was testing on empty string, but let's see if this breaks somewhere.

Marcel

On Sat, Mar 30, 2024 at 6:05 PM lncoll @.***> wrote:

Hi, I've noticed in wadoseriesviewer, windowwidth and windowcenter is ser to 1000 when this info is not at the dicom object. Here I send you a proposal to correct this. Changes marked as lncoll. Hope is useful. Luis wadoseriesviewer.zip https://github.com/marcelvanherk/Conquest-DICOM-Server/files/14812889/wadoseriesviewer.zip

— Reply to this email directly, view it on GitHub https://github.com/marcelvanherk/Conquest-DICOM-Server/issues/39, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVDWJONTDBHBQJK2MMCNEDY23WHBAVCNFSM6AAAAABFPXGNVSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYTMNRQG4ZTSNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

lncoll commented 3 months ago

Just today found an image from an old US system. It has WindowWidth and WindowCenter tags but empty. So supose is better this:

  [[  
  local a=newdicomobject();  
  a:Read("]]..imagelocation..[[");  
  local c = (a.WindowCenter or 0)  
  local w = (a.WindowWidth or 0)  
  if (c==0 or w==0 or c=='' or w=='') then  
    b = (a.BitsStored or 11)  
    w = 2^b  
    c = w/2  
  end  
  local s = (a.RescaleSlope or 1)     if s=='' then s=1 end  
  local i = (a.RescaleIntercept or 0) if i=='' then i=0 end  
  return c.."|"..w.."|"..s.."|"..i  
  ]]  

BitsStored is not optional in a image, so think there is not need to check if empty. No need of math.floor() for w/2 , a power of 2 is always even, ;p

Luis.

marcelvanherk commented 3 months ago

Hi Luis,

just updating it!

Marcel

On Sun, Mar 31, 2024 at 5:00 PM lncoll @.***> wrote:

Just today found an image from an old US system. It has WindowWidth and WindowCenter tags but empty. So supose is better this: [[ local a=newdicomobject(); a:Read("]]..imagelocation..[["); local c = (a.WindowCenter or 0) local w = (a.WindowWidth or 0) if (c==0 or w==0 or c=='' or w=='') then b = (a.BitsStored or 11) w = 2^b c = math.floor(w/2) end local s = (a.RescaleSlope or 1) if s=='' then s=1 end local i = (a.RescaleIntercept or 0) if i=='' then i=0 end return c.."|"..w.."|"..s.."|"..i / ]]

BitsStored is not optional in a image, so think there is not need to check if empty.

Luis.

— Reply to this email directly, view it on GitHub https://github.com/marcelvanherk/Conquest-DICOM-Server/issues/39#issuecomment-2028806279, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVDWJLCZLIEGETRZG5QDMDY3AXJBAVCNFSM6AAAAABFPXGNVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYHAYDMMRXHE . You are receiving this because you commented.Message ID: @.***>

lncoll commented 3 months ago

Tested for more than a week in 4 servers. Seems to work ok. Close the issue.

Thanks Marcel.