DicomController class
The central state manager and orchestrator for DICOM file processing and rendering.
DicomController is responsible for:
- Communicating with the high-performance Rust core to parse DICOM files.
- Managing the lifecycle of GPU textures (cleaning up when no longer needed).
- Keeping track of interactive states like Windowing (contrast/brightness) and Zoom.
- Notifying the UI of changes to facilitate a reactive experience.
For enterprise use, it uses the DicomService which can be swapped for custom implementations (e.g., local storage vs. cloud-based DICOM PACS).
Usage:
final controller = DicomController();
await controller.initialize();
await controller.loadFromFile(filePath: 'path/to/scan.dcm');
- Inheritance
-
- Object
- ChangeNotifier
- DicomController
Constructors
- DicomController({DicomService? service})
- Creates a DicomController.
Properties
- currentFrame → DicomFrameResult?
-
The full result of the latest DICOM processing operation.
no setter
- errorMessage → String?
-
The latest error message produced by the controller or the underlying services.
no setter
- hasData → bool
-
Returns
trueonly if both the metadata and the GPU texture are ready for rendering.no setter - hasError → bool
-
Returns
trueif any step of the loading or processing pipeline failed.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isLoading → bool
-
Returns
truewhile the Rust backend is busy parsing a file.no setter - metadata → DicomMetadata?
-
The medical metadata (Patient Name, SOP ID, Window defaults) for the current file.
no setter
- rawTexture → Image?
-
The internal 16-bit texture packed for GPU consumption.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shader → FragmentShader?
-
The GLSL shader instance used to compute windowing on the GPU.
no setter
- windowCenter → double?
-
The current Window Center (Level) being applied to the image.
no setter
- windowWidth → double?
-
The current Window Width being applied to the image.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
adjustWindowing(
{required double deltaX, required double deltaY}) → void - Adjusts the Window Center and Width relative to current values.
-
clear(
) → void - Clears the current session data and frees memory.
-
dispose(
) → void -
Disposes resources used by the controller, including GPU textures.
override
-
initialize(
) → Future< void> - Loads the necessary fragment shaders from the plugin assets.
-
loadFromFile(
{required String filePath, DicomConfig? config}) → Future< void> - Loads a DICOM file from the local file system.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetWindowing(
) → void - Resets the contrast and brightness to the defaults found in the DICOM headers.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateWindowing(
{double? center, double? width}) → void - Updates the Window Center and Width to specific values.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited