Author |
Topic |
|
yeohray2
Malaysia
108 Posts |
Posted - Oct 23 2022 : 04:41:27
|
In a CT image, there are sometimes client values 'burned' into the image e.g.
While I can anonymize the DICOM tags using the ImageEn functions, I cannot modify the image while still retaining the image information. By this, I mean I can only save DICOM images where the IO.Params.DICOM_Range = iedrAdjust.
So I tried removing the code that stops me from saving images with that option. I noticed the comment:
// ranges partially applied, not supported! raise EIEException.Create('DICOM_Range = iedrSetBlackWhite not supported for saving');
So first question is, what do you mean by ranges partially applied?
Having removed that, I can save the modified image, and the HU units are preserved. However, the DICOM tag values are modified somewhat. So I tried injecting the DICOM tags from the original image, but the original WindowWidth and WindowCenter values are not injected.
This is because AssignCriticalTags is called, which preserves the target image's values. I could modify the code, but would like to know if there is another way to get around this.
Basically, I have a DICOM image loaded with iedrBlackWhite, where I need to 'clear' some pixels by changing the pixels_ie16g values directly. I then need to save this DICOM image, retaining the original HU values and DICOM tag values.
Thank you in advance.
Ray
|
|
xequte
38723 Posts |
Posted - Oct 24 2022 : 21:14:44
|
Hi Ray
With DICOM a pixel can have a range that is outside of unsigned values (0...65535) e..g negative numbers, or using less than 16 bits (14, 13, etc). In ImageEn (in case of 16 bit pixel) only pixels in the 0..65535 range are supported.
"Partially applied" means we first adjust the pixel values to fit into the full unsigned 16 bit range, and then make this range visible by setting BlackValue and WhiteValue (not further changing pixel values).
So, even with iedrSetBlackWhite the image is modified. In many cases it is simply not practical to make the saved image have the original parameters (WindowCenter, WindowWidth, RescaleIntercept, RescaleSlope, PixelRepresentation, BitsAllocated, BitsStored, etc...).
Nigel Xequte Software www.imageen.com
|
|
|
yeohray2
Malaysia
108 Posts |
Posted - Oct 25 2022 : 10:33:27
|
Hi Nigel,
Thanks for the details.
Ray |
|
|
xequte
38723 Posts |
Posted - Mar 06 2024 : 21:23:28
|
Loading Example ImageEnView1.IO.NativePixelFormat := true; ImageEnView1.IO.Params.DICOM_Range := iedrSetBlackWhite; ImageEnView1.IO.LoadFromFile( 'D:\slice91.dcm' ); dcenter := ImageEnView1.IO.Params.DICOM_WindowCenterOffset + StrToFloat( edtLevel.Text ); dMin := dcenter - 0.5 - StrToFloat( edtWidth.Text ) - 1) / 2; dMax := dcenter - 0.5 + StrToFloat( edtWidth.Text ) - 1) / 2; ImageEnView1.IEBitmap.BlackValue := dMin; ImageEnView1.IEBitmap.WhiteValue := dMax; ImageEnView1.Update();
Saving Example // Saving a DICOM that was loaded using iedrSetBlackWhite ImageEnView1.IEBitmap.StretchValues(); ImageEnView1.IO.Params.DICOM_Range := iedrAdjust; ImageEnView1.IO.SaveToFileDICOM( SaveImageEnDialog1.FileName );
Nigel Xequte Software www.imageen.com
|
|
|
xequte
38723 Posts |
Posted - Sep 09 2024 : 00:14:31
|
Hi
Note that in v13.5.1 and newer, ImageEn automatically converts iedrSetBlackWhite to iedrAdjust on saving.
Nigel Xequte Software www.imageen.com
|
|
|
|
Topic |
|
|
|