Segmentation object generation - RubinLab/epad-ws GitHub Wiki

DSOUtil

  • Reads the updated frame numbers if sent as a parameter and creates a DSOEditRequest with the project and series information or reads the json that is sent in the http request and creates a DSOEditRequest from that json.
  • Extracts png mask files from the http request
  • Downloads all the images in the image series.
  • Generates empty tiff files for all the slices of the dso using the first image in the series as a reference and emptying it
  • Copies the tiff files generated from the received png mask files to the correct slice using the frame number (maps to the instance number of the slice)

If there is just one dicom slice but the frame number is is greater than one, just copies to the first ignoring the frame number

TiffMasksToDSOConverter

  • Reads the header tags of the first and last dicom file in the image series. If the height and/or width is different, goes through all the images in the series to find the largest, then gets SliceThickness, ImageOrientationPatient, ClinicalTrial information, slice locations and instance numbers. If the same instance number is present in multiple images in a series, orders the slices using the SliceLocation and numbers the instances starting from 1; if that's not the case and instance numbers are good, orders the slices according to the existing instance numbers.
  • By default, the dsos in ePad are created as optimized (we remove the empty frames). If the minimum instance number is greater than 1 or OptimizedDSOs property in the configuration is set to false, all the frames are saved in the dso.
  • Reads the pixels from the mask files to a byte array, marks the empty frame numbers and the first frame dso starts when reading
  • Writes the dso using the segmentation objects file writer with all the information retrieved from the request and source dicom files

SegmentationObjectsFileWriter

  • Adds one segment using the category, type, modifier and color retrieved from the dso creation hhtp request
  • Adds all frames using the pixel data and considering the type (BINARY or PROBABILITY/OCCUPANCY)
  • For new segmentation objects, creates a unique series and instance uid using pixelmed's uid generator with a series number 1000.