[Insight-developers] Naming Conventions with StatisticsRefactoring
Bradley Lowekamp
blowekamp at mail.nih.gov
Mon Apr 13 08:42:54 EDT 2009
From the Style Guide:
3.4.1 Naming Classes
Classes are named beginning with a capital letter. Classes are placed
in the appropriate namespace,
typically itk:: (see namespaces below). Classes are named according to
the following general rule:
class name = <algorithm><input><concept>
In this formula, the name of the algorithm or process (possibly with
an associated adjective or
adverb) comes first, followed by an input type (if the class is a
filter), and completed by a concept
name. A concept is an informal classification describing what a class
does. There are many
concepts, here are a few of them. The more common or important
concepts are underlined.
Classifier Classify a pixel.
Filter A class that participates in the data processing pipeline.
Filters typically take one or more
inputs and produce one or more outputs.
I agree it doesn't sound right. But ImageClassifierFilter is derived
from ImageToImageFilter. I think just about every class derived from
it end is ImageFilter, so I think that is what we must do here too.
Additional names to consider:
SampleClassifierImageFilter
ImageClassifierImageFilter
SampleClassifierSampleFilter
Brad
On Apr 11, 2009, at 1:43 PM, Karthik Krishnan wrote:
> Brad:
>
> the existing nomenclature sounds fine.
>
> It sounds right to have ImageClassifierFilter or ClassifyImageFilter.
>
> ClassifierImageFilter just sounds like wrong english, don't you
> think ?
>
> Thanks
> --
> karthik
>
> On Sat, Apr 11, 2009 at 1:32 PM, Bradley Lowekamp <blowekamp at mail.nih.gov
> > wrote:
> That looks right. But I have not looked through all the filters....
> What about the Classifiers?
>
> itkImageClassifierFilter -> itkClassifierImageFilter
> itkSampleClassifierFilter -> itkClassifierSampleFilter
>
> ?
>
>
>
> On Apr 11, 2009, at 1:24 PM, Bill Lorensen wrote:
>
> looks good to me. Brad?
>
> On Sat, Apr 11, 2009 at 1:22 PM, Karthik Krishnan
> <karthik.krishnan at kitware.com> wrote:
> Thanks. Its the following then
>
> CovarianceFilter -> CovarianceSampleFilter
> MeanFilter -> MeanSampleFilter
> StandardDeviationPerComponentF
> ilter -> StandardDeviationPerSampleComponentFilter
> WeightedCovarianceFilter -> WeightedCovarianceSampleFilter
> WeightedMeanFilter -> WeightedMeanSampleFilter
> Is this fine ?
>
>
> On Sat, Apr 11, 2009 at 1:10 PM, Bill Lorensen <bill.lorensen at gmail.com
> >
> wrote:
>
> Hmmm..
> the Mean filter is filtering samples so it should be MeanSampleFilter
> just like itkMeanImageFilter (not ImageMeanFilter).
>
> On Sat, Apr 11, 2009 at 12:59 PM, Karthik Krishnan
> <karthik.krishnan at kitware.com> wrote:
> I like Brad's suggestion too.
>
> As it is, most statistics filters are new, (they used to exist as
> calculators), so while christening them for the first time, might as
> well
> name them right.
>
> A minor improvement on Brad's suggestion follows:
>
> Looking at the existing classes in Code/Numerics/Statistics, I can
> see
> the
> following names :
>
> ListSampleToHistogramFilter
> SampleMeanShiftBlurringFilter
> SampleMeanShiftClusteringFilter
> SampleSelectiveMeanShiftBlurringFilter
> SampleToHistogramProjectionFilter
>
> Perhaps this indicates that the "sample" should be the prefix rather
> than
> the suffix since its taken as the input
>
> Unless someone objects, I'll rename the following classes in the
> sandbox
> :
>
> CovarianceFilter -> SampleCovarianceFilter
> MeanFilter -> SampleMeanFilter
> StandardDeviationPerComponentFilter ->
> SampleStandardDeviationPerComponentFilter
> WeightedCovarianceFilter -> SampleWeightedCovarianceFilter
> WeightedMeanFilter -> SampleWeightedMeanFilter
>
> Thanks
> --
> karthik
>
>
> On Sat, Apr 11, 2009 at 12:21 PM, Bill Lorensen
> <bill.lorensen at gmail.com>
> wrote:
>
> I like it.
>
> On Sat, Apr 11, 2009 at 11:45 AM, Bradley Lowekamp
> <blowekamp at mail.nih.gov> wrote:
> As all image filters in it end with ImageFilter for their name, I
> think
> a similar naming convention should be done with the statistics.
> Consider
> the
> following
> $ ls *Filter.h
> itkCovarianceFilter.h itkSampleToSubsampleFilter.h
> itkHistogramToTextureFeaturesFilter.h
> itkScalarImageToCooccurrenceListSampleFilter.h
> itkImageClassifierFilter.h itkScalarImageToCooccurrenceMatrixFilter.h
> itkImageToHistogramFilter.h itkScalarImageToTextureFeaturesFilter.h
> itkImageToListSampleFilter.h itkStandardDeviationPerComponentFilter.h
> itkMeanFilter.h itkWeightedCovarianceFilter.h
> itkSampleClassifierFilter.h itkWeightedMeanFilter.h
> This is just a listing of all the filters. But keeping object type
> which
> the
> filters operate on seem like a very important convention to maintain.
> For
> example
> itkMeanFilter.h -> itkMeanSampleFilter
> itkWeightedCovarianceFilter.h ->
> itkWeightedCovarianceSampleFilter
> itkWeightedMeanFilter.h ->
> itkWeightedMeanSampleFilter
>
> Some of the conversion type filters are a bit more complicated as to
> what
> this qualifier in the name should be. On the other side there is not
> a
> common base class, so the naming could be justified as different
> because
> of
> this...
> Brad
> On Apr 11, 2009, at 11:05 AM, Karthik Krishnan wrote:
>
> It seems rather cryptic and related to the following commit in some
> way.
>
> --- Source/itkSubsample.h (revision 4044)
> +++ Source/itkSubsample.h (working copy)
> @@ -70,6 +70,9 @@
>
> + /** Get the Id Holder */
> + itkGetConstReferenceMacro(IdHolder, InstanceIdentifierHolder);
>
>
> Thanks
> --
> karthik
>
>
> On Sat, Apr 11, 2009 at 11:02 AM, Bill Lorensen
> <bill.lorensen at gmail.com>
> wrote:
>
> I'll take a look today.
>
> On Sat, Apr 11, 2009 at 10:22 AM, Karthik Krishnan
> <karthik.krishnan at kitware.com> wrote:
> Hi Bill:
>
> Thanks for looking at this. I am getting a few build errors after
> updating
> with your changes. They are reported on the following experimental
> build
> from my laptop (gcc4.3 linux)
>
> http://www.cdash.org/CDash/viewBuildError.php?buildid=310844
>
> Any idea ? There are cryptic errors from std::operator <<
>
> Thanks
> --
> karthik
>
> On Sat, Apr 11, 2009 at 9:35 AM, Bill Lorensen
> <bill.lorensen at gmail.com>
> wrote:
>
> I checked in a fix modeled after itkNumericTraitsRGBPixel.h.
> Fortunately, since the template is short it's not quite as ugly.
>
> Bill
>
> On Sat, Apr 11, 2009 at 9:21 AM, Bill Lorensen
> <bill.lorensen at gmail.com>
> wrote:
> Looks like a similar issued is handled by
> Insight/Code/Common/itkNumericTraitsRGBPixel.h with some
> macros.
>
> Bill
>
>
>
>
>
> --
> Karthik Krishnan
> R&D Engineer,
> Kitware Inc.
> Ph: 518 881 4919
> Fax: 518 371 4573
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090413/4ac2335d/attachment.htm>
More information about the Insight-developers
mailing list