[Insight-developers] MetaDataObject Checkins
Hans Johnson
hans-johnson@uiowa.edu
Mon, 10 Mar 2003 11:13:12 -0600
Stephen,
The itk::MetaDataDictionary is a map (inherits from
std::map<std::string,itk::MetaDataObjectBase>). The
itk::MetaDataObjectBase is an abstract class that defines the interface
to itk::MetaDataObject<T> where T is any type.
I am working on the doing extactly what you want for the itkAnalyzeIO,
and I hope to have that done by this afternoon or early tomarrow with
documentation and examples in a test case.
Right now I am trying to clean up the mess I made in committing this
information.
Regards,
Hans J. Johnson
Stephen R. Aylward wrote:
> 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
>>
>>
>
>
--
===================================================================
Hans J. Johnson W294 GH
hans-johnson@uiowa.edu Dept. of Psychiatry
http://www.psychiatry.uiowa.edu/~hjohnson The University of Iowa
(319) 353-8587 Iowa City, IA 52242
===================================================================