8000 improve CZI-write by ptahmose · Pull Request #10 · ptahmose/MEXlibCZI · GitHub
[go: up one dir, main page]

Skip to content

improve CZI-write - #10

Merged
ptahmose merged 3 commits into
masterfrom
jbl/improve_write
Mar 23, 2025
Merged

ptahmose merged 3 commits into
masterfrom
jbl/improve_write

Conversation

@ptahmose
Copy link
Copy Markdown
Owner

This adds DisplaySettings-metadata to the CZI, which works around problems where the document is not displayed correctly in some ZEN-versions.

The XML-metadata is still very rudimentary, and the API does not allow to modify it currently. For the example testWriteMultiChannelCZIAndOpenItAndCheck we get this XML-metadata:

<ImageDocument>
  <Metadata>
    <Information>
      <Image>
        <SizeX>1024</SizeX>
        <SizeY>768</SizeY>
        <SizeC>8</SizeC>
        <SizeM>1</SizeM>
        <Dimensions>
          <Channels>
            <Channel Id="Channel:0">
              <PixelType>Gray8</PixelType>
            </Channel>
            <Channel Id="Channel:1">
              <PixelType>Gray8</PixelType>
            </Channel>
            <Channel Id="Channel:2">
              <PixelType>Gray8</PixelType>
            </Channel>
            <Channel Id="Channel:3">
              <PixelType>Gray8</PixelType>
            </Channel>
            <Channel Id="Channel:4">
              <PixelType>Gray8</PixelType>
            </Channel>
            <Channel Id="Channel:5">
              <PixelType>Gray8</PixelType>
            </Channel>
            <Channel Id="Channel:6">
              <PixelType>Gray8</PixelType>
            </Channel>
            <Channel Id="Channel:7">
              <PixelType>Gray8</PixelType>
            </Channel>
          </Channels>
        </Dimensions>
        <PixelType>Gray8</PixelType>
      </Image>
    </Information>
    <DisplaySetting>
      <Channels>
        <Channel Id="Channel:0">
          <IsSelected>true</IsSelected>
          <ColorMode>None</ColorMode>
          <Low>0</Low>
          <High>1</High>
        </Channel>
        <Channel Id="Channel:1">
          <IsSelected>true</IsSelected>
          <ColorMode>None</ColorMode>
          <Low>0</Low>
          <High>1</High>
        </Channel>
        <Channel Id="Channel:2">
          <IsSelected>true</IsSelected>
          <ColorMode>None</ColorMode>
          <Low>0</Low>
          <High>1</High>
        </Channel>
        <Channel Id="Channel:3">
          <IsSelected>true</IsSelected>
          <ColorMode>None</ColorMode>
          <Low>0</Low>
          <High>1</High>
        </Channel>
        <Channel Id="Channel:4">
          <IsSelected>true</IsSelected>
          <ColorMode>None</ColorMode>
          <Low>0</Low>
          <High>1</High>
        </Channel>
        <Channel Id="Channel:5">
          <IsSelected>true</IsSelected>
          <ColorMode>None</ColorMode>
          <Low>0</Low>
          <High>1</High>
        </Channel>
        <Channel Id="Channel:6">
          <IsSelected>true</IsSelected>
          <ColorMode>None</ColorMode>
          <Low>0</Low>
          <High>1</High>
        </Channel>
        <Channel Id="Channel:7">
          <IsSelected>true</IsSelected>
          <ColorMode>None</ColorMode>
          <Low>0</Low>
          <High>1</High>
        </Channel>
      </Channels>
    </DisplaySetting>
  </Metadata>
</ImageDocument>

Updated the `Close` method to handle C-dimension statistics.
If the C-dimension is valid, default display settings are applied
to each channel to prevent display issues in certain ZEN versions.
The metadata builder is utilized to write these settings before
retrieving the XML for metadata writing.
Updated `CMakeLists.txt` to increment the patch version of the `MEXLIBCZI` library from 4 to 5.
Refactored the `Close()` method in `CziWriter.cpp` to utilize a `unique_ptr` for better memory management.
Added a new test function in `TestMEXlib_Write.m` to validate multi-channel CZI file creation and properties.
Added details on available pixel types for argument #4 and options for argument #6 in the writer object's subblock documentation.
@ptahmose
ptahmose merged commit 99cf96d into master Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0