-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DICOM-SEG only displayed when I load it first #563
Comments
There are several enhancements for reading SEG files in the next version. |
Can you confirm whether this problem has been fixed? |
In the last version I am not able to load my segmentation at all. When I load DICOM-SEG first, then DICOMs, it doesn't display anything and seems to break the UI a little bit - some tabs have not text. when I load DICOMs first, and then DICOM-SEG, it just doesn't display segmentation here is the log https://gist.github.com/inikishev/9732660c0df14530da4327526a1688a1 I downloaded the DICOMs here https://github.com/datalad/example-dicom-structural, and saved some bogus segmentation, which should look like this example DICOM-SEG.zip here is a DICOM-SEG file (I zipped it because github doesnt accept .dcm). |
Your SEG file is not consistent. The SEG object must be a distinct series and therefore needs a new series instance UID. The same series can only have one modality type (MR and SEG is not possible). |
thank you for the information. I was using highdicom and I set |
Unfortunately I am not able to get it working. I followed https://razorx89.github.io/pydicom-seg/guides/write.html, this is my code import numpy as np
import pydicom
import pydicom_seg
import SimpleITK as sitk
template = pydicom_seg.template.from_dcmqi_metainfo('metainfo.json')
writer = pydicom_seg.MultiClassWriter(
template=template,
# inplane_cropping=True, # Crop image slices to the minimum bounding box on
# # x and y axes
# skip_empty_slices=True, # Don't encode slices with only zeros
# skip_missing_segment=False, # If a segment definition is missing in the
# # template, then raise an error instead of
# # skipping it.
)
reader = sitk.ImageSeriesReader()
# https://github.com/datalad/example-dicom-structural
series_instance_uid = pydicom.dcmread('/var/mnt/hdd/Datasets/Example DICOMs/dicoms/N2D_0001.dcm').SeriesInstanceUID
dcm_files = reader.GetGDCMSeriesFileNames('/var/mnt/hdd/Datasets/Example DICOMs/dicoms', series_instance_uid)
reader.SetFileNames(dcm_files)
image = reader.Execute()
image_data = sitk.GetArrayFromImage(image)
def process_image(arr):
arr = np.random.randint(size = arr.shape, low = 0, high = 2, dtype = np.uint8)
assert arr.min() == 0
assert arr.max() == 1
return arr
segmentation_data = process_image(image_data)
segmentation = sitk.GetImageFromArray(segmentation_data)
segmentation.CopyInformation(image)
source_images = [
pydicom.dcmread(x, stop_before_pixels=True)
for x in dcm_files
]
dcm = writer.write(segmentation, source_images)
dcm.save_as('segmentation.dcm') and this is metainfo.json {
"ContentCreatorName": "Reader1",
"ClinicalTrialSeriesID": "Session1",
"ClinicalTrialTimePointID": "1",
"SeriesDescription": "Segmentation",
"SeriesNumber": "300",
"InstanceNumber": "1",
"segmentAttributes": [
[
{
"labelID": 1,
"SegmentDescription": "Meningioma",
"SegmentAlgorithmType": "AUTOMATIC",
"SegmentAlgorithmName": "bogus",
"SegmentedPropertyCategoryCodeSequence": {
"CodeValue": "49755003",
"CodingSchemeDesignator": "SCT",
"CodeMeaning": "Morphologically Altered Structure"
},
"SegmentedPropertyTypeCodeSequence": {
"CodeValue": "4147007",
"CodingSchemeDesignator": "SCT",
"CodeMeaning": "Mass"
},
"recommendedDisplayRGBValue": [
144,
238,
144
]
}
]
],
"ContentLabel": "SEGMENTATION",
"ContentDescription": "Image segmentation",
"ClinicalTrialCoordinatingCenterName": "dcmqi",
"BodyPartExamined": "Brain"
} the SEG file itself is OK, I can open it with AlizaMS However nothing seems to happen when I open it in weasis. |
Describe the bug. What happened?
When I drag DICOM-SEG file into Weasis, and THEN drag the linked images, the segmentation panel works.
However when I first open an image, and then open the segmentation for it, nothing happens, no segmentation appears. The only change is an orange circle that appears on the linked image thumbnail:
![image](https://private-user-images.githubusercontent.com/76593873/341362870-f99104d9-9677-44d5-ad13-9af3b5262ba5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MTY3NTMsIm5iZiI6MTczOTUxNjQ1MywicGF0aCI6Ii83NjU5Mzg3My8zNDEzNjI4NzAtZjk5MTA0ZDktOTY3Ny00NGQ1LWFkMTMtOWFmM2I1MjYyYmE1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDA3MDA1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU3MmYzNWVhMjUzM2QxODgyZGRkMmNlN2NhMjNhN2M0MDA4YzUzMDI2OGIxZmI2NGZjZDA1OWU0YTA4MWVlNWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.uThdey5CiEF_6h3jHAxBLACbXEyO59fqrpZANf4A4Rs)
What version of Weasis are you running?
4.4.0
On which system the problem occurs?
Windows
Relevant log output
No response
Additional contextual elements
No response
The text was updated successfully, but these errors were encountered: