On 18.08.2015 19:31, Sascha Zelzer wrote:
Hi Daniel,

long time no see ;-)

Hi Sascha,

that's true, but it is a pleasure to be working with/on MITK again!

Thank you for your explanations, this summarizes very well what is happening in the code. I actually did not see the sorting of MIME types in the first place, this is a bit hidden by using a (sorting) std::set. Also, I did not see that you can/should register a custom MIME type as a service which can have a ranking property.

Providing a custom MIME type with higher ranking is working fine. My custom image type is now getting selected by default in the "Save.." dialog.

For others who might be trying to give more weight to their custom data type writers, here is a code summary of how to achieve this in your module activator (assuming your custom writer is in a module):

        us::ServiceProperties mimeTypeProperties;
mimeTypeProperties[us::ServiceConstants::SERVICE_RANKING()] = 1; // just bigger than 0

// MySpecialBaseDataWriterprovides a GetCustomMimeType() method which returns
        // a CustomMimeType describing the type, file extensions etc.
// The module activator holds one instance of this CustomMimeType as a service instance mitk::CustomMimeType* m_MimePrototype = new mitk::CustomMimeType( MySpecialBaseDataWriter::GetCustomMimeType() ); context->RegisterService( m_MimePrototype, mimeTypeProperties); // _with_ properties!

Again, thanks a lot for the explanations!

Best,
Daniel

--
Dr. Daniel Maleike, Mint Medical GmbH
Friedrich-Ebert-Straße 2, 69221 Dossenheim/Heidelberg
Geschäftsführer: Dr. Matthias Baumhauer, Registergericht Mannheim, HRB 709351

------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to