![]()
This page will give you all the information you need to create your own OsiriX plugin (.osirixplugin file extension) to add new features or specific functionalities to
Before starting, make sure you have:
Contains all the headers for accessing OsiriX API from your plugin. It is located in OsiriX MD /Contents/Frameworks: to access it, right-click on Contents/Frameworks. You will have to copy the OsiriXAPI.framework to your plugin folder (see below).To develop a plugin you have 2 options (see bellow):
OsiriXAPI.framework in your MyOsiriXPluginFolder folder.
.osirixplugin extension) in:
/Library/Application Support/OsiriX/Plugins.~/Library/Application Support/OsiriX/Plugins), because of permissions issues.

OsiriXAPI.framework in your MyOsiriXPluginFolder folder.Plugin.m and Plugin.h files (for Objective-C) or a Plugin.swift file (for Swift) in your Xcode folder, and add them to your project:
Plugin.m file:
#import “Plugin.h”
// You can then import different API headers to use the OsiriX functions.
// These headers are stored in the OsiriXAPI framework folder
#import <OsiriXAPI/BrowserController.h>
#import <OsiriXAPI/DicomStudy.h>
#import <OsiriXAPI/DicomSeries.h>
#import <OsiriXAPI/DicomStudy+Report.h>
#import <OsiriXAPI/DicomDatabase.h>
#import <OsiriXAPI/WebPortal.h>
#import <OsiriXAPI/NSManagedObject+N2.h>
#import <OsiriXAPI/WebPortalUser.h>
#import <OsiriXAPI/WebPortalStudy.h>
#import <OsiriXAPI/WebPortalConnection.h>
#import <OsiriXAPI/WebPortalConnection+Data.h>
#import <OsiriXAPI/WebPortal.h>
#import <OsiriXAPI/WebPortal+Email+Log.h>
#import <OsiriXAPI/WebPortalResponse.h>
#import <OsiriXAPI/WebPortalDatabase.h>
#import <OsiriXAPI/AsyncSocket.h>
#import <OsiriXAPI/QueryController.h>
@implementation YOURPLUGINCLASS
– (long) filterImage: (NSString*) menuName {
if( [menuName containsString: @”Settings”]) {
[NSApp beginSheet: myWindow modalForWindow: nil modalDelegate:self didEndSelector:@selector( settingsDidEnd:returnCode:contextInfo:) contextInfo: nil];
[myWindow orderFront:self];
}
return 0;
}
– (IBAction)okButton: (id)sender {
[myWindow close];
}
– (void) initPlugin
{
// Instantiate the Settings xib file
[NSBundle loadNibNamed: @”Settings” owner:self];
NSLog( @”Hello from my plugin. This function is executed when OsiriX launches.”);
}
@end
Plugin.h file:
#import <Foundation/Foundation.h>
#import <OsiriXAPI/PluginFilter.h>
@interface YOURPLUGINCLASS : PluginFilter
{
IBOutlet NSWindow *myWindow;
}
– (long) filterImage: (NSString*) menuName;
@end
Plugin.swift file:
import Foundation
class YOURPLUGINCLASS: PluginFilter {
@IBOutlet var myWindow: NSWindow!
override func filterImage(_ menuName: String!) -> Int {
if( menuName == “Settings”) {
NSApp.beginSheet( myWindow, modalFor: BrowserController.currentBrowser().window!, modalDelegate: nil, didEnd: nil, contextInfo: nil)
}
return 0 // no error
}
@IBAction func okButton(_ sender: Any) {
myWindow.close()
}
override func initPlugin() {
let bundle = Bundle.init( identifier: “com.rossetantoine.OsiriXTestPlugin”)
bundle?.loadNibNamed( “Settings”, owner: self, topLevelObjects: nil)
NSLog( “Hello from my plugin. This function is executed when OsiriX launches.”)
}
}
osirixplugin in Build Settings.

YOURPLUGINCLASS (see Plugin.m and Plugin.h, or Plugin.swift) in Build Settings.

-undefined dynamic_lookup in the Other Linker Flags in Build Settings.
MenuTitle key, and use the following types for the pluginType key: Database, Report, imageFilter, roiTool or other.
.osirixplugin extension) in:
/Library/Application Support/OsiriX/Plugins.~/Library/Application Support/OsiriX/Plugins), because of permissions issues.