ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 DICOM Set Window Level and Window Width
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

PatrickH

4 Posts

Posted - Jan 30 2019 :  02:34:21  Show Profile  Reply
Hi,

we have a DICOM-File with Preset-Values (Window Level 2047 and Window Width 4095).. a good view would be by Level=152, Width=1616.

Is it possible to change this values to customize the view? Like ImageEnView1->Proc->SetWWWL(x, y)

Best Regards,
Patrick

xequte

4854 Posts

Posted - Jan 30 2019 :  19:17:23  Show Profile  Reply
Hi

You can apply custom Windows center and width values by setting ImageEnView1.BlackValue and WhiteValue:

ImageEnView1.IEBitmap.BlackValue := WindowCenter - Round(0.5 * WindowWidth);
ImageEnView1.IEBitmap.WhiteValue := WindowCenter + Trunc(0.5 * WindowWidth);
ImageEnView1.Update();


Also see:
https://www.imageen.com/help/ImageEn/TIOParams.DICOM_WindowCenterOffset.html
https://www.imageen.com/help/ImageEn/TIOParams.DICOM_Range.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PatrickH

4 Posts

Posted - Jan 31 2019 :  05:38:50  Show Profile  Reply
Hi,

ok, now it works great with TImageEnView

TIEBitmap *bmp = new TIEBitmap();
TImageEnIO *pIO = new TImageEnIO(bmp);
pIO->NativePixelFormat = true;
pIO->Params->DICOM_Range = iedrSetBlackWhite;
pIO->LoadFromFile("D:\\slice-205.dcm");
double dcenter = pIO->Params->DICOM_WindowCenterOffset + this->edLevel->Text.ToDouble();
double dMin =  dcenter - 0.5 - (this->edWidth->Text.ToDouble() -1) /2;
double dMax = dcenter - 0.5 + (this->edWidth->Text.ToDouble() -1) /2;
bmp->BlackValue = dMin;
bmp->WhiteValue = dMax;
this->img->IEBitmap->Assign(bmp);


The only thing left is the same with MultiSlice-Files. Here we use TImageEnMView to load the File.

ImageEnMView1->MIO->Params->DICOM_Range = iedrSetBlackWhite;
ImageEnMView1->MIO->LoadFromFile("D:\\Multi\\I24.dcm");


Params is here not possible because ImageEnMView1->MIO->Params = NULL
Is it possible to set the DICOM_Range before loading the File to TImageEnMView?

Patrick
Go to Top of Page

xequte

4854 Posts

Posted - Jan 31 2019 :  14:56:52  Show Profile  Reply
Hi Patrick

After loading you can iterate through the bitmaps using ImageEnMView1.GetTIEBitmap();

https://www.imageen.com/help/ImageEn/TImageEnMView.GetTIEBitmap.html

Wrap this and the loading code in LockUpdate/UnlockUpdate calls to prevent onscreen ugliness.


Alternatively, you can load your dicom image into a TIEBitmap, and then append that to the TImageEnMView (iterating if the image has multiple frames).



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PatrickH

4 Posts

Posted - Feb 01 2019 :  05:53:00  Show Profile  Reply
Hi Nigel,

if i load the file (multiple frames) like this:
ImageEnMView1->MIO->NativePixelFormat = true;
ImageEnMView1->MIO->LoadFromFile("D:\\ZZ_Temp\\Multi\\I24.dcm"); // multiframe file


the PixelValues are adjusted (maybe) in "iedicom.pas"
procedure TDicomReadContext.AdjustRange16g();
begin
  case IOParams.DICOM_Range of
    iedrAdjust:        AdjustRange16g_adjust();
    iedrSetBlackWhite: AdjustRange16g_set();
  end;
end;


The Usermanual says:

TIOParams.DICOM_Range
Declaration
property DICOM_Range: TIEDicomRange;
Description
Specifies how to handle the pixel visibility range.
Default: iedrAdjust

so if i load the File the Bitmaps are already modified.
Is there a way to set DICOM_Range to iedrSetBlackWhite before loading a file to ImageEnMView to get the unmodified Images?



Regards
Patrick
Go to Top of Page

xequte

4854 Posts

Posted - Feb 03 2019 :  17:46:44  Show Profile  Reply
Hi

In the next release you can control it using IEGlobalSettings().IOParamDefaults:

https://www.imageen.com/help/ImageEn/TIEImageEnGlobalSettings.IOParamDefaults.html


You can email me for a pre-release.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

rbeaulieu

Canada
13 Posts

Posted - Oct 22 2019 :  18:08:36  Show Profile  Reply
Hi,

How can I correctly display the attached DICOM image using WWidth and WLevel (range iedrSetBlackWhite).

I think the issue has something to do with rescaleslope, wich is 2.81 and data type valid range exceed in code (word = trunc(double) causing word value restart from 0).

Someone can help ?
(sample dicom file attached)

Regent.

attach/rbeaulieu/2019102218416_Chest.zip
2322.62 KB

Regards.
Go to Top of Page

xequte

4854 Posts

Posted - Oct 23 2019 :  15:34:07  Show Profile  Reply
Hi Regent

This image looks OK to me. Can you clarify your requirements:



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

rbeaulieu

Canada
13 Posts

Posted - Oct 26 2019 :  12:52:56  Show Profile  Reply
Hi Nigel,

Sorry, I forgot to tell that I want open the image in a window width and level ajustement goal, so I load image with this code :

IEV1.IO.NativePixelFormat := true;
IEV1.IO.Params.DICOM_Range := iedrSetBlackWhite;
IEV1.IO.LoadFromFile(AFName);

The image at le left is WW and WC adjusted by setting black and white level. The function work well for DICOM image with rescale slope set to 1.0.

The same image at the right is correctly show in a popular DICOM viewer.



Regards.
Go to Top of Page

xequte

4854 Posts

Posted - Oct 29 2019 :  16:21:43  Show Profile  Reply
Hi

Please email me for a fix for this.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To: