Skip to content

Commit

Permalink
ENH: Add ZIP write support
Browse files Browse the repository at this point in the history
Enabled by this WIP version of TensorStore:
dzenanz/tensorstore@9b51dee
  • Loading branch information
dzenanz committed Mar 29, 2023
1 parent 8c121c4 commit f51d9ff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/itkOMEZarrNGFFImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "itkIntTypes.h"
#include "itkByteSwapper.h"

#include <filesystem>

#include "tensorstore/context.h"
#include "tensorstore/open.h"
#include "tensorstore/index_space/dim_expression.h"
Expand Down Expand Up @@ -564,6 +566,14 @@ OMEZarrNGFFImageIO::WriteImageInformation()
void
OMEZarrNGFFImageIO::Write(const void * buffer)
{
std::filesystem::path file(this->GetFileName());
if (std::filesystem::is_regular_file(file))
{
// work around current limitation of TensorStore's ZIP support
// by deleting the existing zip file
std::filesystem::remove(file);
}

this->WriteImageInformation();

if (itkToTensorstoreComponentType(this->GetComponentType()) == tensorstore::dtype_v<void>)
Expand Down

0 comments on commit f51d9ff

Please sign in to comment.