Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions misc/c3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ set(HEADER_FILES
include/inviwo/c3d/io/c3dreader.h
include/inviwo/c3d/ports/c3dport.h
include/inviwo/c3d/processors/c3daveragedpositions.h
include/inviwo/c3d/processors/c3dcrop.h
include/inviwo/c3d/processors/c3dpointalignment.h
include/inviwo/c3d/processors/c3dsequencecrop.h
include/inviwo/c3d/processors/c3dsequenceinfo.h
include/inviwo/c3d/processors/c3dsource.h
include/inviwo/c3d/processors/c3dtodataframe.h
include/inviwo/c3d/processors/c3dtomesh.h
Expand All @@ -26,7 +29,10 @@ set(SOURCE_FILES
src/io/c3dreader.cpp
src/ports/c3dport.cpp
src/processors/c3daveragedpositions.cpp
src/processors/c3dcrop.cpp
src/processors/c3dpointalignment.cpp
src/processors/c3dsequencecrop.cpp
src/processors/c3dsequenceinfo.cpp
src/processors/c3dsource.cpp
src/processors/c3dtodataframe.cpp
src/processors/c3dtomesh.cpp
Expand Down
10 changes: 7 additions & 3 deletions misc/c3d/include/inviwo/c3d/datastructures/c3ddata.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include <inviwo/c3d/c3dmoduledefine.h>

#include <inviwo/core/metadata/metadataowner.h>

#include <memory>
#include <string>
#include <filesystem>
Expand All @@ -42,7 +44,7 @@

namespace inviwo {

class IVW_MODULE_C3D_API C3D : public ezc3d::c3d {
class IVW_MODULE_C3D_API C3D : public ezc3d::c3d, public MetaDataOwner {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

misc/c3d/include/inviwo/c3d/datastructures/c3ddata.h:47:1: warning: [misc-multiple-inheritance]

inheriting multiple classes that aren't pure virtual is discouraged

   47 | class IVW_MODULE_C3D_API C3D : public ezc3d::c3d, public MetaDataOwner {
      | ^

clang-tidy diagnostic

misc/c3d/include/inviwo/c3d/datastructures/c3ddata.h:47:26: warning: [cppcoreguidelines-special-member-functions]

class 'C3D' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

   47 | class IVW_MODULE_C3D_API C3D : public ezc3d::c3d, public MetaDataOwner {
      |                          ^

public:
using ezc3d::c3d::c3d;

Expand All @@ -52,13 +54,16 @@ class IVW_MODULE_C3D_API C3D : public ezc3d::c3d {
};

C3D(const std::filesystem::path& path, Options options);
C3D(const C3D& source, size_t firstFrame, size_t lastFrame);

C3D(const C3D& rhs) : ezc3d::c3d{static_cast<const ezc3d::c3d&>(rhs).clone()} {}
C3D(const C3D& rhs)
: ezc3d::c3d{static_cast<const ezc3d::c3d&>(rhs).clone()}, MetaDataOwner{rhs} {}
C3D(C3D&&) = default;

C3D& operator=(const C3D& that) {
if (this != &that) {
ezc3d::c3d::operator=(static_cast<const ezc3d::c3d&>(that).clone());
MetaDataOwner::operator=(that);
}
return *this;
}
Expand All @@ -71,7 +76,6 @@ class IVW_MODULE_C3D_API C3D : public ezc3d::c3d {
ezc3d::DataNS::Data& data() { return *_data; }
const ezc3d::DataNS::Data& data() const { return *_data; }


private:
void updateHeaderImpl();
void updateParametersImpl();
Expand Down
65 changes: 65 additions & 0 deletions misc/c3d/include/inviwo/c3d/processors/c3dcrop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2026 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/

#pragma once

#include <inviwo/c3d/c3dmoduledefine.h>
#include <inviwo/core/processors/processor.h>
#include <inviwo/core/properties/boolproperty.h>
#include <inviwo/core/properties/minmaxproperty.h>

#include <inviwo/c3d/ports/c3dport.h>
#include <inviwo/dataframe/datastructures/dataframe.h>
#include <inviwo/dataframe/properties/columnoptionproperty.h>

namespace inviwo {

class IVW_MODULE_C3D_API C3DCrop : public Processor {
public:
C3DCrop();

virtual void process() override;

virtual const ProcessorInfo& getProcessorInfo() const override;
static const ProcessorInfo processorInfo_;

private:
C3DDataInport inport_;
DataFrameInport dataframe_;
C3DDataOutport outport_;

BoolProperty enabled_;
ColumnOptionProperty sequenceIndex_;
ColumnOptionProperty firstFrame_;
ColumnOptionProperty lastFrame_;

IntSizeTMinMaxProperty frame_;
};

} // namespace inviwo
66 changes: 66 additions & 0 deletions misc/c3d/include/inviwo/c3d/processors/c3dsequencecrop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2026 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/

#pragma once

#include <inviwo/c3d/c3dmoduledefine.h>
#include <inviwo/core/processors/poolprocessor.h>
#include <inviwo/core/properties/boolproperty.h>
#include <inviwo/core/datastructures/datasequence.h>
#include <inviwo/core/ports/datainport.h>
#include <inviwo/core/ports/dataoutport.h>

#include <inviwo/c3d/datastructures/c3ddata.h>
#include <inviwo/c3d/datastructures/c3ddatatraits.h>
#include <inviwo/dataframe/datastructures/dataframe.h>
#include <inviwo/dataframe/properties/columnoptionproperty.h>

namespace inviwo {

class IVW_MODULE_C3D_API C3DSequenceCrop : public PoolProcessor {
public:
C3DSequenceCrop();

virtual void process() override;

virtual const ProcessorInfo& getProcessorInfo() const override;
static const ProcessorInfo processorInfo_;

private:
DataInport<DataSequence<C3D>> inport_;
DataOutport<DataSequence<C3D>> outport_;
DataFrameInport dataframe_;

BoolProperty enabled_;
ColumnOptionProperty sequenceIndex_;
ColumnOptionProperty firstFrame_;
ColumnOptionProperty lastFrame_;
};

} // namespace inviwo
62 changes: 62 additions & 0 deletions misc/c3d/include/inviwo/c3d/processors/c3dsequenceinfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2026 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/

#pragma once

#include <inviwo/c3d/c3dmoduledefine.h>
#include <inviwo/core/processors/processor.h>
#include <inviwo/core/properties/ordinalproperty.h>
#include <inviwo/core/properties/ordinaloptproperty.h>
#include <inviwo/core/datastructures/datasequence.h>
#include <inviwo/core/ports/datainport.h>
#include <inviwo/core/ports/dataoutport.h>

#include <inviwo/c3d/datastructures/c3ddata.h>
#include <inviwo/c3d/datastructures/c3ddatatraits.h>

namespace inviwo {

class IVW_MODULE_C3D_API C3DSequenceInfo : public Processor {
public:
C3DSequenceInfo();

virtual void process() override;

virtual const ProcessorInfo& getProcessorInfo() const override;
static const ProcessorInfo processorInfo_;

private:
DataInport<DataSequence<C3D>> inport_;
DataOutport<DataSequence<C3D>> outport_;

IntProperty sequenceSize_;
OrdinalOptProperty<int> maxSequenceSize_;
};

} // namespace inviwo
1 change: 1 addition & 0 deletions misc/c3d/include/inviwo/c3d/processors/c3dtomesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class IVW_MODULE_C3D_API C3DToMesh : public Processor {
BrushingAndLinkingInport bnl_;
MeshOutport outport_;

BoolProperty cropFrames_;
IntSizeTMinMaxProperty frame_;
FloatProperty markerRadius_;
BoolProperty skipEmpty_;
Expand Down
6 changes: 6 additions & 0 deletions misc/c3d/src/c3dmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
#include <inviwo/c3d/io/c3dreader.h>
#include <inviwo/c3d/ports/c3dport.h>
#include <inviwo/c3d/processors/c3daveragedpositions.h>
#include <inviwo/c3d/processors/c3dcrop.h>
#include <inviwo/c3d/processors/c3dpointalignment.h>
#include <inviwo/c3d/processors/c3dsequencecrop.h>
#include <inviwo/c3d/processors/c3dsequenceinfo.h>
#include <inviwo/c3d/processors/c3dsource.h>
#include <inviwo/c3d/processors/c3dtodataframe.h>
#include <inviwo/c3d/processors/c3dtomesh.h>
Expand Down Expand Up @@ -65,7 +68,10 @@ struct SequenceToDataFrameTraits<C3D> {

C3DModule::C3DModule(InviwoApplication* app) : InviwoModule(app, "C3D") {
registerProcessor<C3DAveragedPositions>();
registerProcessor<C3DCrop>();
registerProcessor<C3DPointAlignment>();
registerProcessor<C3DSequenceCrop>();
registerProcessor<C3DSequenceInfo>();
registerProcessor<C3DSource>();
registerProcessor<C3DSequenceSource>();
registerProcessor<C3DToDataFrame>();
Expand Down
35 changes: 33 additions & 2 deletions misc/c3d/src/datastructures/c3ddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ C3D::C3D(const std::filesystem::path& path, Options options) : ezc3d::c3d{} {
// number of frames is larger than 65535. We need to make sure the
// rotational data are not present in the file after the points and analogs
// data in order to use "all-of-file" (nbFrames = -1) reading
nbFrames = -1;
nbFrames = static_cast<size_t>(-1);
}

for (size_t j = 0; j < nbFrames; ++j) {
Expand Down Expand Up @@ -137,6 +137,36 @@ C3D::C3D(const std::filesystem::path& path, Options options) : ezc3d::c3d{} {
stream.close();
}

C3D::C3D(const C3D& source, size_t firstFrame, size_t lastFrame)
: ezc3d::c3d{}, MetaDataOwner{source} {

// identical with ezc3d::c3d::clone() except for cloning the data
_filePath = source._filePath;
options = source.options.clone();
_header = std::make_shared<ezc3d::Header>(source._header->clone());
_parameters = std::make_shared<ezc3d::ParametersNS::Parameters>(source._parameters->clone());
_data = std::make_shared<ezc3d::DataNS::Data>();

// clone only valid subset of frames
firstFrame = std::max(firstFrame, _header->firstFrame());
lastFrame = std::min(lastFrame, _header->lastFrame());

// create firstFrame - 1 empty frames so we can subsequently add the actual frames
if (firstFrame > 0) {
_data->frame({}, firstFrame - 1u);
}
for (const auto& frame : source._data->frames() | std::views::drop(firstFrame) |
std::views::take(lastFrame - firstFrame + 1)) {
_data->frame(frame.clone());
}

// update header
_header->firstFrame(firstFrame);
_header->lastFrame(lastFrame);

updateParametersImpl();
}

ezc3d::DataNS::Points3dNS::Points copyPoints(const ezc3d::DataNS::Frame& srcFrame) {
ezc3d::DataNS::Points3dNS::Points pts;
for (size_t i = 0; i < srcFrame.points().nbPoints(); ++i) {
Expand Down Expand Up @@ -253,7 +283,8 @@ std::shared_ptr<ezc3d::c3d> copy(const ezc3d::c3d& src) {
}

// The updateHeader and updateParameters functions are not exported using EZC3D_API so we can't call
// them So as a _ugly_ _ugly_ workaround, we copy the code here. This is not ideal but it works for now.
// them So as a _ugly_ _ugly_ workaround, we copy the code here. This is not ideal but it works for
// now.

void C3D::updateHeaderImpl() {
// Parameter is always consider as the right value.
Expand Down
Loading
Loading