@@ -38,30 +38,58 @@ Features
3838The following features are available:
3939
4040- Reading *CLF * files to a Python representation.
41-
42- The following features are planned and in development:
43-
4441- Writing *CLF * files from the Python representation.
45- - Validating *CLF * files according to the specification .
42+ - Executing *CLF * workflows and applying them to colours or images .
4643
47- Features that will not be part of this library:
48-
49- - Executing *CLF * workflows and applying them to colours or images. This feature will be implemented as part of `Colour
50- <https://github.com/colour-science/colour/> `__.
5144
5245Examples
5346^^^^^^^^
5447
55- The main entry point of the library is the ``read_clf `` function in the main namespace.
48+ The main entry point of the library is the ``read_clf `` function in the main namespace, which allows one to parse
49+ a CLF document:
5650
5751.. code-block :: python
5852
5953 import colour_clf_io
6054
61- example = """
62- <?xml version="1.0" ?>
63- <ProcessList xmlns="urn:AMPAS:CLF:v3.0" id="Example Wrapper" compCLFversion="2.0">
64- <LUT3D id="lut-24" name="green look" interpolation="trilinear" inBitDepth="12i" outBitDepth="16f">
55+ example = """ <?xml version="1.0" ?>
56+ <ProcessList xmlns="urn:AMPAS:CLF:v3.0" id="Example Wrapper" compCLFversion="2.0">
57+ <LUT3D id="lut-24" name="green look" interpolation="trilinear" inBitDepth="12i" outBitDepth="16f">
58+ <Description>3D LUT</Description>
59+ <Array dim="2 2 2 3">
60+ 0.0 0.0 0.0
61+ 0.0 0.0 1.0
62+ 0.0 1.0 0.0
63+ 0.0 1.0 1.0
64+ 1.0 0.0 0.0
65+ 1.0 0.0 1.0
66+ 1.0 1.0 0.0
67+ 1.0 1.0 1.0
68+ </Array>
69+ </LUT3D>
70+ </ProcessList>
71+ """ # noqa: E501
72+ clf_doc = colour_clf_io.read_clf(example)
73+ print (clf_doc)
74+
75+ .. code-block :: text
76+
77+ ProcessList(id='Example Wrapper', compatible_CLF_version='3.0', process_nodes=[LUT3D(id='lut-24', name='green look', in_bit_depth=<BitDepth.i12: '12i'>, out_bit_depth=<BitDepth.f16: '16f'>, description='3D LUT', array=Array(values=[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0], dim=(2, 2, 2, 3)), half_domain=False, raw_halfs=False, interpolation=<Interpolation3D.TRILINEAR: 'trilinear'>)], name=None, inverse_of=None, description=[], input_descriptor='', output_descriptor='', info=Info(app_release=None, copyright=None, revision=None, aces_transform_id=None, aces_user_name=None, calibration_info=None))
78+
79+ For writing a CLF file the ``write_clf `` function can be used to serialise a ``ProcessList `` back to XML:
80+
81+
82+ .. code-block :: python
83+
84+ xml = colour_clf_io.write_clf(clf_doc)
85+ print (xml)
86+
87+ .. code-block :: text
88+
89+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
90+ <ProcessList xmlns="urn:AMPAS:CLF:v3.0" compCLFversion="3.0" id="Example Wrapper">
91+ <Info/>
92+ <LUT3D id="lut-24" inBitDepth="12i" interpolation="trilinear" name="green look" outBitDepth="16f">
6593 <Description>3D LUT</Description>
6694 <Array dim="2 2 2 3">
6795 0.0 0.0 0.0
@@ -73,15 +101,21 @@ The main entry point of the library is the ``read_clf`` function in the main nam
73101 1.0 1.0 0.0
74102 1.0 1.0 1.0
75103 </Array>
76- </LUT3D>
104+ </LUT3D>
77105 </ProcessList>
78- """ # noqa: E501
79- clf_doc = colour_clf_io.read_clf(EXAMPLE_WRAPPER .format(example))
80- print (clf_doc)
106+
107+ To execute a CLF workflow, you can create a *CLFProcessList * that can be applied to some input.
108+
109+ .. code-block :: python
110+
111+ lut = colour_clf_io.CLFProcessList(clf_doc)
112+ input_value = [0 , 32768 , 65535 ]
113+ result = lut.apply(input_value)
114+ print (result)
81115
82116 .. code-block :: text
83117
84- ProcessList(id='Example Wrapper', compatible_CLF_version='3.0', process_nodes=[LUT3D(id='lut-24', name='green look', in_bit_depth=<BitDepth.i12: '12i'>, out_bit_depth=<BitDepth.f16: '16f'>, description='3D LUT', array=Array(values=[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0], dim=(2, 2, 2, 3)), half_domain=False, raw_halfs=False, interpolation=<Interpolation3D.TRILINEAR: 'trilinear'>)], name=None, inverse_of=None, description=[], input_descriptor='', output_descriptor='', info=Info(app_release=None, copyright=None, revision=None, aces_transform_id=None, aces_user_name=None, calibration_info=None))
118+ [ 0. 1. 1.]
85119
86120 User Guide
87121----------
@@ -98,6 +132,10 @@ Primary Dependencies
98132- `lxml >= 5.2.1 < 6 <https://pypi.org/project/lxml/ >`__
99133- `numpy >= 1.24, < 2 <https://pypi.org/project/numpy >`__
100134
135+ If you want to execute CLF workflows, you will also need
136+
137+ - `colour-science >= 0.4.6 <https://pypi.org/project/colour-science >`__
138+
101139Pypi
102140~~~~
103141
@@ -111,6 +149,17 @@ The overall development dependencies are installed as follows::
111149
112150 pip install --user 'colour-clf-io[development]'
113151
152+ UV
153+ ~~~~
154+
155+ Using uv you can simply install **Colour - CLF IO ** via::
156+
157+ uv add colour-clf-io
158+
159+ or, if you want to execute CLF workflows::
160+
161+ uv add colour-clf-io --optional processing
162+
114163
115164Contributing
116165^^^^^^^^^^^^
0 commit comments