[Insight-developers] MetaDataObject Checkins

Stephen R. Aylward aylward@unc.edu
Mon, 10 Mar 2003 12:01:46 -0500


Hi,

I thought the MetaData stuff was part of the effort to establish a 
dictionary.   As such, I thought it was going to be tagged data - 
std::map or something similar.  This was probably on Friday's TCon. 
Sorry about that.

I was hoping to tie your MetaData with MetaObjectIO.   That way we could 
read/write these objects/dictionaries.

Right now they look a bit like a base class for traits...

Stephen

Hans Johnson wrote:
> Bill,
> 
> 2)-------------
> Can you tell me what part of the specializations is not portable?
> 
> The idea behind the itkMetaDataObject is that it can encapsulate
> anything.  Because of that I made a default
> itk::MetaDataObject<T>::PrintSelf that just printed a string stating
> that the type can not print itself.  Then specializations of that
> function could be written for cases where print self was well defined.
> 
> For example, encapsulating a native C types would be done with the
> trivial implementations of:
> itk::MetaDataObject<int>
> ::PrintSelf(std::ostream& os, Indent indent) const
> {
>    os << indent << this->m_MetaDataObjectValue << std::endl;
> }
> 
> whereas encapsulating an itk::Image would use:
> 
> itk::MetaDataObject<int>
> ::PrintSelf(std::ostream& os, Indent indent) const
> {
>    this->m_MetaDataObjectValue->PrintSelf(os,indent);
> }
> 
> and non itk-application developers could write:
> itk::MetaDataObject<MyElephantClass>
> ::PrintSelf(std::ostream& os, Indent indent) const
> {
>    std::cout << indent
>              << this->m_MetaDataObjectValue->GetTrunk()
>              << " "
>              << this->m_MetaDataObjectValue->GetEars()
>              << " "
>              << this->m_MetaDataObjectValue->GetTail()
>              << std::endl;
> }
> 
> The current implementation will have to be changed, because it will work
> only for classes that have the operator<< defined to work with ostreams.
> 
> If you or anyone else has a portable way of doing this, please let me
> know, and I will implement it right away.
> 
> Again, sorry about causing all these problems.
> 
> Regards,
> Hans J. Johnson
> hans-johnson@uiowa.edu
> 
> 
> 
> Lorensen, William E (Research) wrote:
>  > Hans,
>  >
>  > I corrected a couple of problems with your checkins.
>  >
>  > 1) itkMetaDataObject.txx did not have #define guards around the code. 
> In itk, all .txx files must be
>  > includable on their own. To enforce this, the header test generator 
> will include the .txx file if one
>  > exists. I added guards.
>  >
>  > 2) I removed the specialization of the printself methods. The usage 
> was not portable, but looking
>  > into at the code it l;ooks like you don't need the specialization. I 
> moved the output into the
>  > class's PrintSelf. I lalso removed all the code form the 
> itkMetaDataObject.cxx file. I did not remove
>  > that file form CMakeLists.txt file because I wasn't sure if you have 
> future plans for this file.
>  >
>  > I made the changes so that we can get some clean continuous builds 
> early today. I know that Bill Hoff
>  > is ready to check in his vnl changes.
>  >
>  > Bill
>  >
>  > _______________________________________________
>  > Insight-developers mailing list
>  > Insight-developers@public.kitware.com
>  > http://public.kitware.com/mailman/listinfo/insight-developers
> 
> 


-- 
===============================================
Dr. Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://caddlab.rad.unc.edu
aylward@unc.edu
(919) 966-9695