Skip to content

Conversation

@jilei-hao
Copy link
Owner

Pelvis module modification and review.

@jilei-hao jilei-hao self-assigned this Aug 24, 2022
Copy link
Owner Author

@jilei-hao jilei-hao left a comment

Choose a reason for hiding this comment

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

Great work! @K-Prather
I especially like the way you added data into the project, simple and elegant. Modularization is also good, clean and effective coding.

void Generate();
vtkPolyData* GetOutput();

private:
Copy link
Owner Author

Choose a reason for hiding this comment

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

Internal data should be kept private and add public accessor such as GetXXXData(); SetXXXData(); for indirect public access.

private:
float m_IntercristalDistance;
float m_PelvisScaleFactor;
vtkSmartPointer<vtkPolyData> m_PelvisOutputPolydata;
Copy link
Owner Author

Choose a reason for hiding this comment

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

For data storage, a vtkSmartPointer is recommended rather than just a pointer. This brings convenience in memory management. Without this, an explicit deletion of this pointer should be included in the class' destructor, or there will be memory leak.

PelvisModelGenerator();
~PelvisModelGenerator();
PelvisModelGenerator(const PelvisModelGenerator &other);
PelvisModelGenerator(const PelvisModelGenerator &other) = delete;
Copy link
Owner Author

Choose a reason for hiding this comment

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

It's great to always explicit define copy and assignment operators. But they does not always need to be enabled. We can define them to be deleted which prevent any copy or assignment operations, which are usually safer.

This case for a filter like class, unless we absolutely need it to be copied or assigned, we can define them to be deleted just to be safe.


private:
float m_IntercristalDistance;
float m_PelvisScaleFactor;
Copy link
Owner Author

Choose a reason for hiding this comment

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

The original name is absolutely fine. Using "m_" prefix for member variable is just a convention adopted by many people.


this->intercristalDistance = 1;
this->pelvisScaleFactor = 1;
this->m_IntercristalDistance = 1;
Copy link
Owner Author

Choose a reason for hiding this comment

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

In this file most of changes are variable name changes. See header file comment for the reason.

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.

2 participants