Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some fixes for readerwriter #95

Merged
merged 25 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
964185b
clang-tidy fixes
ptahmose Feb 16, 2023
c3d0b08
cosmetic
ptahmose Feb 17, 2023
52059d7
Merge branch 'main' of https://github.com/ptahmose/libczi-zeiss
ptahmose Jul 30, 2023
1f11468
Merge branch 'main' of https://github.com/ptahmose/libczi-zeiss
ptahmose Oct 30, 2023
94bdc16
Merge branch 'ZEISS:main' into main
ptahmose Nov 2, 2023
09d3d84
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Nov 3, 2023
c9858ae
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Nov 6, 2023
0418230
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Nov 18, 2023
ed654c9
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Nov 20, 2023
ab75b94
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Nov 22, 2023
9877f58
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Dec 9, 2023
8cea702
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Dec 12, 2023
9d9ea2b
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Dec 30, 2023
0deb3a6
Merge branch 'main' of github.com:ptahmose/libczi-zeiss
ptahmose Feb 9, 2024
7345030
some fixes for czireaderwriter
ptahmose Feb 10, 2024
a341b3e
bump version
ptahmose Feb 10, 2024
bcac932
fix link
ptahmose Feb 10, 2024
50ec6a5
implement some missing methods
ptahmose Feb 11, 2024
764db70
update
ptahmose Feb 11, 2024
9904b8b
clean up CZIReader.cpp
ptahmose Feb 11, 2024
8d270fb
add unittests for newly implemented methods of CziReaderWriter
ptahmose Feb 11, 2024
3b7c66f
cosmetic
ptahmose Feb 11, 2024
9e2843c
cosmetic
ptahmose Feb 11, 2024
cb591c2
linter
ptahmose Feb 11, 2024
15e7198
formatting...
ptahmose Feb 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW) # enable new "MSVC runtime library selection" (https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)

project(libCZI
VERSION 0.58.0
VERSION 0.58.1
HOMEPAGE_URL "https://github.com/ZEISS/libczi"
DESCRIPTION "libCZI is an Open Source Cross-Platform C++ library to read and write CZI")

Expand Down
21 changes: 12 additions & 9 deletions Src/libCZI/CziReaderWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@
wi.writeFunc = std::bind(&CCziReaderWriter::WriteToOutputStream, this, placeholders::_1, placeholders::_2, placeholders::_3, placeholders::_4, placeholders::_5);
wi.useSpecifiedAllocatedSize = false;

auto sizeOfSbBlk = CWriterUtils::WriteSubBlock(wi, addSbBlkInfo);
this->nextSegmentInfo.SetNextSegmentPos(wi.segmentPos + sizeOfSbBlk /*+ sizeof(SegmentHeader)*/);
const auto sizeOfSbBlk = CWriterUtils::WriteSubBlock(wi, addSbBlkInfo);
this->nextSegmentInfo.SetNextSegmentPos(wi.segmentPos + sizeOfSbBlk);
}

/*virtual*/void CCziReaderWriter::SyncAddAttachment(const libCZI::AddAttachmentInfo& addAttachmentInfo)
Expand Down Expand Up @@ -415,13 +415,14 @@
},
&attchmntDirSegmentSize);

this->attachmentDirectory.SetModified(false);
this->attachmentDirectorySegment.SetPositionAndAllocatedSize(pos, attchmntDirSegmentSize.AllocatedSize, false);
}

pos = this->hdrSegmentData.GetMetadataPosition();
if (pos != 0)
{
auto segmentSize = CCZIParse::ReadSegmentHeader(CCZIParse::SegmentType::Metadata, this->stream.get(), this->hdrSegmentData.GetMetadataPosition());
const auto segmentSize = CCZIParse::ReadSegmentHeader(CCZIParse::SegmentType::Metadata, this->stream.get(), this->hdrSegmentData.GetMetadataPosition());
this->metadataSegment.SetPositionAndAllocatedSize(pos, segmentSize.AllocatedSize, false);
}
}
Expand Down Expand Up @@ -641,12 +642,14 @@
[&](int index, const CCziSubBlockDirectory::SubBlkEntry& entry)->bool
{
SubBlockInfo info;
info.coordinate = entry.coordinate;
info.logicalRect = IntRect{ entry.x,entry.y,entry.width,entry.height };
info.physicalSize = IntSize{ (std::uint32_t)entry.storedWidth, (std::uint32_t)entry.storedHeight };
info.mIndex = entry.mIndex;
info.pixelType = CziUtils::PixelTypeFromInt(entry.PixelType);
return funcEnum(index, info);
info.compressionModeRaw = entry.Compression;
info.pixelType = CziUtils::PixelTypeFromInt(entry.PixelType);
info.coordinate = entry.coordinate;
info.logicalRect = IntRect{ entry.x,entry.y,entry.width,entry.height };
info.physicalSize = IntSize{ (std::uint32_t)entry.storedWidth, (std::uint32_t)entry.storedHeight };
info.mIndex = entry.mIndex;
info.pyramidType = CziUtils::PyramidTypeFromByte(entry.pyramid_type_from_spare);
return funcEnum(index, info);

Check warning on line 652 in Src/libCZI/CziReaderWriter.cpp

View check run for this annotation

Codecov / codecov/patch

Src/libCZI/CziReaderWriter.cpp#L645-L652

Added lines #L645 - L652 were not covered by tests
});
}

Expand Down
4 changes: 3 additions & 1 deletion Src/libCZI/CziWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,10 +733,11 @@ void libCZI::ICziWriter::SyncAddSubBlock(const AddSubBlockInfoStridedBitmap& add

std::unique_ptr<AttachmentEntryA1, void(*)(AttachmentEntryA1*)> upAttchmntData((AttachmentEntryA1*)malloc(sizeAttchmntEntries), [](AttachmentEntryA1* p)->void {free(p); });

size_t index_count = 0;
info.enumEntriesFunc(
[&](size_t index, const CCziAttachmentsDirectoryBase::AttachmentEntry& entry)->bool
{
AttachmentEntryA1* p = (upAttchmntData.get() + index);
AttachmentEntryA1* p = upAttchmntData.get() + index_count;
p->SchemaType[0] = 'A';
p->SchemaType[1] = '1';
memset(&p->_spare[0], 0, sizeof(p->_spare));
Expand All @@ -747,6 +748,7 @@ void libCZI::ICziWriter::SyncAddSubBlock(const AddSubBlockInfoStridedBitmap& add
memcpy(&p->Name[0], &entry.Name[0], sizeof(p->Name));

ConvertToHostByteOrder::Convert(p);
++index_count;
return true;
});

Expand Down
1 change: 1 addition & 0 deletions Src/libCZI/Doc/version-history.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ version history {#version_history}
0.57.2 | [90](https://github.com/ZEISS/libczi/pull/90) | improve thread-safety of CziReader
0.57.3 | [91](https://github.com/ZEISS/libczi/pull/91) | improve error-message
0.58.0 | [92](https://github.com/ZEISS/libczi/pull/92) | export a list with properties for streams-property-bag
0.58.1 | [95](https://github.com/ZEISS/libczi/pull/95) | some fixes for CziReaderWriter
Loading