sparkocr.transformers.dicom.dicom_draw_regions#
Module Contents#
Classes#
Draw regions to dicom. |
- exception NoImage#
Bases:
ExceptionCommon base class for all non-exit exceptions.
- class DicomCleaner#
Bases:
sparkocr.transformers.dicom.base_dicom.BaseDicom- OVERLAY_TAG = 24576#
- cleaned_overlay_data = None#
- frame_numbers = None#
- htj2k_color_space#
- htj2k_lossless_color_space#
- htj2k_lossless_rpcl_color_space#
- is_compressed = False#
- jpeg_2000_color_space#
- jpeg_2000_lossless_color_space#
- jpeg_baseline_8bit_color_space#
- jpeg_extended_12_bit_color_space#
- jpeg_lossless_p14_color_space#
- jpeg_lossless_sv1_color_space#
- jpeg_ls_lossless_color_space#
- jpeg_ls_near_lossless_color_space#
- original = None#
- overlay_data = None#
- readMaxBytes#
- results = None#
- rle_color_space#
- transfer_syntaxes#
- version#
- add_compression_ratio(dicom, original, updated)#
- clean(fix_interpretation=True, pixel_data_attribute='PixelData')#
- clean_frame(index, regions)#
- extract_pixel_using_handler(handler)#
- generate_candidate_regions()#
- get_s3_creds(sql_ctx)#
- classmethod get_transfer_syntax_based_on_dicom_tags(**kwargs)#
Tries to find if the original file syntax is supported for encoding of the pixels. All the listed transfer syntax is supported for decoding, but for encoding they can vary depending on pydicom version. To overcome this gap for support of all transfer syntax we try to
Check if the original transfer syntax is supported.
If any other transfer syntax can be used instead keeping the compression type same.
Else we change the compression type (lossy -> lossless)
Else we fail to find a match
- Returns:
String if there are errors.
- Tuple if there are no errors, the contents and length of all cases are same except the first index.
(Compresssion, _, _, … )
(Non-Compression, _, _, … )
(Failed-Match, _, _, … )
- static infer_reshape_size(frames, rows, cols, samples)#
- open(dicom_file, path, regions, scaleFactor, forceOutput, compressionQuality)#
- static read_dicom(dicom, params, read_max_bytes, origin='', stop_before_pixels=True)#
- classmethod resolve_compression_quality(compression)#
- save_dicom()#
- setReadMaxBytes(value)#
Sets the value of
readMaxBytes.
- classmethod validate_input_dicom_tags(**kwargs)#
Validates basic attributes of the DICOM file such as Photometric Interpretation, Transfer Syntax, Samples Per Pixel, and other relevant metadata.
- Parameters:
pydicom_version (-) – Version of pydicom in use.
force (-) – If True, forces use of a default compression type for unsupported Transfer Syntax.
kwargs (-) – DICOM attributes to validate, including ‘PhotometricInterpretation’, ‘TransferSyntaxUID’, ‘SamplesPerPixel’, ‘BitsAllocated’, ‘BitsStored’, ‘HighBit’, and others.
- Returns:
String if there are missing or invalid tags.
Boolean True if the compression is supported.
Boolean False if the compression is not supported.
- class DicomDrawRegions#
Bases:
pyspark.ml.wrapper.JavaTransformer,pyspark.ml.param.shared.HasInputCol,pyspark.ml.param.shared.HasOutputCol,pyspark.ml.util.DefaultParamsReadable,pyspark.ml.util.DefaultParamsWritable,sparkocr.transformers.params.HasKeepInputDraw regions to dicom.
- aggCols#
- compressionQuality#
- forceOutput#
- inputCol :Param[str]#
- inputRegionsCol#
- keepInput#
- memoryOptimized#
- originCol#
- outputCol :Param[str]#
- outputPartitionSize#
- scaleFactor#
- uid = ''#
- clear(param: pyspark.ml.param.Param) None#
Clears a param from the param map if it has been explicitly set.
- copy(extra: pyspark.ml._typing.ParamMap | None = None) JP#
Creates a copy of this instance with the same uid and some extra params. This implementation first calls Params.copy and then make a copy of the companion Java pipeline component with extra params. So both the Python wrapper and the Java pipeline component get copied.
- Parameters:
extra (dict, optional) – Extra parameters to copy to the new instance
- Returns:
Copy of this instance
- Return type:
JavaParams
- explainParam(param: str | Param) str#
Explains a single param and returns its name, doc, and optional default value and user-supplied value in a string.
- explainParams() str#
Returns the documentation of all params with their optionally default values and user-supplied values.
- extractParamMap(extra: pyspark.ml._typing.ParamMap | None = None) pyspark.ml._typing.ParamMap#
Extracts the embedded default param values and user-supplied values, and then merges them with extra values from input into a flat param map, where the latter value is used if there exist conflicts, i.e., with ordering: default param values < user-supplied values < extra.
- Parameters:
extra (dict, optional) – extra param values
- Returns:
merged param map
- Return type:
dict
- getInputCol() str#
Gets the value of inputCol or its default value.
- getOrDefault(param: str) Any#
- getOrDefault(param: Param[T]) T
Gets the value of a param in the user-supplied param map or its default value. Raises an error if neither is set.
- getOutputCol() str#
Gets the value of outputCol or its default value.
- getParam(paramName: str) Param#
Gets a param by its name.
- hasDefault(param: str | Param[Any]) bool#
Checks whether a param has a default value.
- hasParam(paramName: str) bool#
Tests whether this instance contains a param with a given (string) name.
- isDefined(param: str | Param[Any]) bool#
Checks whether a param is explicitly set by user or has a default value.
- isSet(param: str | Param[Any]) bool#
Checks whether a param is explicitly set by user.
- classmethod load(path: str) RL#
Reads an ML instance from the input path, a shortcut of read().load(path).
- classmethod read() DefaultParamsReader[RL]#
Returns a DefaultParamsReader instance for this class.
- save(path: str) None#
Save this ML instance to the given path, a shortcut of ‘write().save(path)’.
- set(param: Param, value: Any) None#
Sets a parameter in the embedded param map.
- setAggCols(value)#
Sets the value of
setAggCols.
- setCompressionQuality(value)#
Sets the value of
compressionQuality.
- setForceOutput(value)#
Sets the value of
forceOutput.
- setInputRegionsCol(value)#
Sets the value of
inputRegionsCol.
- setMemoryOptimized(value)#
Sets the value of
memoryOptimized.
- setOutputPartitionSize(value)#
Sets the value of
outputPartitionSize.
- setScaleFactor(value)#
Sets the value of
scaleFactor.
- transform(dataset: pyspark.sql.dataframe.DataFrame, params: pyspark.ml._typing.ParamMap | None = None) pyspark.sql.dataframe.DataFrame#
Transforms the input dataset with optional parameters.
New in version 1.3.0.
- Parameters:
dataset (
pyspark.sql.DataFrame) – input datasetparams (dict, optional) – an optional param map that overrides embedded params.
- Returns:
transformed dataset
- Return type:
- transform_dicom(dicom, path, regions, exceptions)#
- write() MLWriter#
Returns a DefaultParamsWriter instance for this class.