ENH: Adding filter and wrapping for casting within SO hierarchy#1576
ENH: Adding filter and wrapping for casting within SO hierarchy#1576aylward merged 4 commits intoInsightSoftwareConsortium:masterfrom aylward:CastSpatialObject
Conversation
This new Cast filter allows all of a specific type of children of a SpatialObjuct to be returned in a list, where the list elements are typed to specifically match the type requested. Compare with the existing GetChildren() function, where the return list's elements are cast to the top level SpatialObject class. The modifications to the CMakeLists.txt file in the wrapping directory allows lists of spatial objects and lists of spatial object points to be accessed via array indexes. When wrapped for python, these changes enable the following code: > castSO = itk.CastSpatialObjectFilter[3].New() > castSO.SetInput(myGroup) > tubesList = castSO.GetTubes() > > tube = tubesList[0] > > print(tube.GetPoints()[0].GetPositionInObjectSpace())
Modules/Core/SpatialObjects/include/itkCastSpatialObjectFilter.h
Outdated
Show resolved
Hide resolved
Modules/Core/SpatialObjects/test/itkCastSpatialObjectFilterTest.cxx
Outdated
Show resolved
Hide resolved
Modules/Core/SpatialObjects/test/itkCastSpatialObjectFilterTest.cxx
Outdated
Show resolved
Hide resolved
Use ITK_DISALLOW macro. Improve variable naming. Remove commented code. Reduce cmake code redundancy via loop.
|
Failing tests seem to be unrelated. Python.GetClassName and Python.Extras failures seem unrelated. |
|
I see the |
|
But itkCastImageFilter....is called filter.
I think consistent naming is more important than revealing the class
hierarchy via a name.
s
…On Wed, Jan 29, 2020 at 2:45 PM Bradley Lowekamp ***@***.***> wrote:
I see the CastSpatialObjectFilter is only derived from itk::Object and
the itk::ProcessObject. I believe the naming convention would say the
class should be called a Calculator or maybe Converter but not filter.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1576?email_source=notifications&email_token=AACEJL6JFMPJUOXHRBABBC3RAHMGBA5CNFSM4KMGEH62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKIP5OQ#issuecomment-579927738>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACEJL2G5L2OMN4KCDIRVU3RAHMGBANCNFSM4KMGEH6Q>
.
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
---
Kitware: *Advancing the frontiers of understanding*
*by developing innovative open-source software platforms*
*and integrating them into research, processes, and products.*
|
|
Per the ITK style guide:
This class is not pipelined and does not meet the concept of a |
|
How about just calling it "CastSpatialObjects"?
…On Wed, Jan 29, 2020 at 3:06 PM Bradley Lowekamp ***@***.***> wrote:
Per the ITK style guide
<https://itk.org/Wiki/ITK/Coding_Style_Guide#Naming_Classes>:
- *Filter* A class that participates in the data processing pipeline.
Filters typically take one or more inputs and produce one or more outputs.
This class is not pipelined and does not meet the concept of a Filter.
Therefore it goes against ITK's naming conventions. I don't think
Calculator is particularly good either. Maybe Mapper?
Caster? Do you have any alternatives?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1576?email_source=notifications&email_token=AACEJL6EPE27CUIC67V77LTRAHOS7A5CNFSM4KMGEH62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKIR5MA#issuecomment-579935920>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACEJL36A5ZJ7KJ4QUQ4RCDRAHOS7ANCNFSM4KMGEH6Q>
.
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
---
Kitware: *Advancing the frontiers of understanding*
*by developing innovative open-source software platforms*
*and integrating them into research, processes, and products.*
|
|
That would be OK to me or maybe Thanks. |
|
Sure!
Will make a new pull request.
…On Wed, Jan 29, 2020 at 3:26 PM Bradley Lowekamp ***@***.***> wrote:
That would be OK to me or maybe SpatialObjectCaster.
Thanks.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1576?email_source=notifications&email_token=AACEJLZXTSBCBQQHDXCF4DDRAHQ7DA5CNFSM4KMGEH62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKITZNQ#issuecomment-579943606>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACEJL4NRK6MZ5BCI7B45KTRAHQ7DANCNFSM4KMGEH6Q>
.
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
---
Kitware: *Advancing the frontiers of understanding*
*by developing innovative open-source software platforms*
*and integrating them into research, processes, and products.*
|
|
Anyone have an opinion on CastSpatialObject vs SpatialObjectCaster?
s
On Wed, Jan 29, 2020 at 3:27 PM Stephen Aylward <stephen.aylward@kitware.com>
wrote:
… Sure!
Will make a new pull request.
On Wed, Jan 29, 2020 at 3:26 PM Bradley Lowekamp ***@***.***>
wrote:
> That would be OK to me or maybe SpatialObjectCaster.
>
> Thanks.
>
> —
> You are receiving this because you modified the open/close state.
> Reply to this email directly, view it on GitHub
> <#1576?email_source=notifications&email_token=AACEJLZXTSBCBQQHDXCF4DDRAHQ7DA5CNFSM4KMGEH62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKITZNQ#issuecomment-579943606>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AACEJL4NRK6MZ5BCI7B45KTRAHQ7DANCNFSM4KMGEH6Q>
> .
>
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
---
Kitware: *Advancing the frontiers of understanding*
*by developing innovative open-source software platforms*
*and integrating them into research, processes, and products.*
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
---
Kitware: *Advancing the frontiers of understanding*
*by developing innovative open-source software platforms*
*and integrating them into research, processes, and products.*
|
|
@aylward nice work on this!! 🥇
It is an odd duck, 🦆 but |
|
I bet I could make this derive from ProcessObject in a legit way.
Second template argument specifies the desired type returned by GetOutput,
but also keeping the named output functions (e.g., GetTubes).
Let's keep this pull request and merge as-is, and I'll work on a new pull
request that converts this class into a legit filter.
Thanks
s
…On Thu, Jan 30, 2020 at 5:11 PM Matt McCormick ***@***.***> wrote:
@aylward <https://github.com/aylward> nice work on this!! 🥇
Anyone have an opinion on CastSpatialObject vs SpatialObjectCaster?
It is an odd duck, 🦆 but CastSpatialObjectFilter is better than the
proposed alternatives. It does not inherit from ProcessObject; but, this
transforms objects from inputs to outputs, so it fits the general
definition of "filter". We do not have any other Caster's in the toolkit.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1576?email_source=notifications&email_token=AACEJL76VGZULO2Q2BUULWTRANGARA5CNFSM4KMGEH62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKMYEWQ#issuecomment-580485722>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACEJL7AXI5ITVIAG3GX62DRANGARANCNFSM4KMGEH6Q>
.
--
Stephen R. Aylward, Ph.D.
Senior Director of Strategic Initiatives
---
Kitware: *Advancing the frontiers of understanding*
*by developing innovative open-source software platforms*
*and integrating them into research, processes, and products.*
|
Closed issues: CMake configure warning with CMake 3.30 and newer #1579 Merged pull requests: pkgconfig: drop unused libraries from Libs.private #1591 (bgilbert) Fix CMake warning: Compatibility with CMake < 3.10 will be removed #1580 (dzenanz) code documentation updates #1576 (weanti) Fixed ICC profile copy failure on write #1574 (mircomir) opj_jp2_read_header: Check for error after parsing header. #1573 (sebras) (CVE-2025-54874)
This new Cast filter allows all of a specific type of children of a
SpatialObjuct to be returned in a list, where the list elements are typed to
specifically match the type requested. Compare with the existing
GetChildren() function, where the return list's elements are cast to
the top level SpatialObject class.
The modifications to the CMakeLists.txt file in the wrapping directory
allows lists of spatial objects and lists of spatial object points to be
accessed via array indexes.
When wrapped for python, these changes enable the following code: