Skip to content

Commit

Permalink
DP 1.1.1: text encoding fix for disc cover template merge text, and u…
Browse files Browse the repository at this point in the history
…ses [DicomDir createDicomDirAtDir:] if available, instead of dcmmkdir

git-svn-id: https://svn.code.sf.net/p/osirixplugins/code@177 bdd3870d-6ba2-4b59-8605-1de7af000970
  • Loading branch information
aglv committed Nov 7, 2011
1 parent 202873d commit 9fdf866
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 28 deletions.
1 change: 1 addition & 0 deletions DiscPublishing/Classes/DiscPublishing.mm
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,5 @@ -(void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)obj change:(NSDict
}
}


@end
6 changes: 5 additions & 1 deletion DiscPublishing/Classes/DiscPublishingJob.mm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ -(void)start {

// the merging of the template and csv is buggy in the framework, we do this ourselves
NSString* csvFile = [self.root stringByAppendingPathExtension:@"csv"];
[[N2CSV stringFromArray:[self.info objectForKey:DiscPublishingJobInfoMergeValuesKey]] writeToFile:csvFile atomically:YES encoding:NSMacOSRomanStringEncoding error:NULL];
NSArray* mergeValues = [self.info objectForKey:DiscPublishingJobInfoMergeValuesKey];
// NSLog(@"Merge values: %@", mergeValues);
NSString* mergeString = [N2CSV stringFromArray:[self.info objectForKey:DiscPublishingJobInfoMergeValuesKey]];
// NSLog(@"Merge string: %@", mergeString);
[mergeString writeToFile:csvFile atomically:YES encoding:NSUTF8StringEncoding error:NULL];
self.printFile = [self.root stringByAppendingPathExtension:@"jpg"];

[DiscPublishingJob renderDiscCover:templatePath merge:csvFile into:self.printFile];
Expand Down
32 changes: 17 additions & 15 deletions DiscPublishing/Classes/DiscPublishingPatientDisc.mm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#import "DiscPublishingTasksManager.h"
#import <OsiriXAPI/NSThread+N2.h>
#import <OsiriXAPI/N2Debug.h>
#import <OsiriXAPI/DicomDir.h>


static NSString* PreventNullString(NSString* s) {
Expand Down Expand Up @@ -145,21 +146,22 @@ +(NSString*)discNameForSeries:(NSArray*)series {
}

+(void)generateDICOMDIRAtDirectory:(NSString*)root withDICOMFilesInDirectory:(NSString*)dicomPath {
/* if ([dicomPath hasPrefix:root]) {
NSUInteger index = root.length;
if ([dicomPath characterAtIndex:index] == '/')
++index;
dicomPath = [dicomPath substringFromIndex:index];
}*/

NSTask* dcmmkdirTask = [[NSTask alloc] init];
[dcmmkdirTask setEnvironment:[NSDictionary dictionaryWithObject:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"dicom.dic"] forKey:@"DCMDICTPATH"]];
[dcmmkdirTask setLaunchPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"dcmmkdir"]];
[dcmmkdirTask setCurrentDirectoryPath:root];
[dcmmkdirTask setArguments:[NSArray arrayWithObjects:@"+r", @"-Pfl", @"-W", @"-Nxc", @"+I", @"+m", @"+id", dicomPath, NULL]];
[dcmmkdirTask launch];
[dcmmkdirTask waitUntilExit];
[dcmmkdirTask release];
// newer versions of osirix (since revision 9105) have a DicomDir class with a createDicomDirAtDir: class method
if ([NSClassFromString(@"DicomDir") respondsToSelector:@selector(createDicomDirAtDir:)])
{
[DicomDir createDicomDirAtDir:root];
}
else // before that, we had to use the dcmmkdir binary bundled with OsiriX
{
NSTask* dcmmkdirTask = [[NSTask alloc] init];
[dcmmkdirTask setEnvironment:[NSDictionary dictionaryWithObject:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"dicom.dic"] forKey:@"DCMDICTPATH"]];
[dcmmkdirTask setLaunchPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"dcmmkdir"]];
[dcmmkdirTask setCurrentDirectoryPath:root];
[dcmmkdirTask setArguments:[NSArray arrayWithObjects:@"+r", @"-Pfl", @"-W", @"-Nxc", @"+I", @"+m", @"+id", dicomPath, NULL]];
[dcmmkdirTask launch];
[dcmmkdirTask waitUntilExit];
[dcmmkdirTask release];
}
}

-(void)main {
Expand Down
11 changes: 5 additions & 6 deletions DiscPublishing/DiscPublishing.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
5956BB7511D380350016EF6D /* DiscPublishingPreferencesController+RobotOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "DiscPublishingPreferencesController+RobotOptions.h"; path = "Classes/DiscPublishingPreferencesController+RobotOptions.h"; sourceTree = "<group>"; };
5956BB7611D380350016EF6D /* DiscPublishingPreferencesController+RobotOptions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "DiscPublishingPreferencesController+RobotOptions.mm"; path = "Classes/DiscPublishingPreferencesController+RobotOptions.mm"; sourceTree = "<group>"; };
5956BC0E11D3A2610016EF6D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Resources/English.lproj/DiscPublishingPreferencesBinView.xib; sourceTree = "<group>"; };
596D309C143999E7004EE9EC /* TODO.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = TODO.txt; path = ../DiscPublishing2.2/TODO.txt; sourceTree = "<group>"; };
596D309C143999E7004EE9EC /* TODO.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = TODO.txt; sourceTree = SOURCE_ROOT; };
5971022B113FE9A500875159 /* NSArray+DiscPublishing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+DiscPublishing.h"; path = "Classes/Extras/NSArray+DiscPublishing.h"; sourceTree = "<group>"; };
5971022C113FE9A500875159 /* NSArray+DiscPublishing.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "NSArray+DiscPublishing.mm"; path = "Classes/Extras/NSArray+DiscPublishing.mm"; sourceTree = "<group>"; };
59710240113FEA0E00875159 /* DiscPublishingFilesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DiscPublishingFilesManager.h; path = Classes/DiscPublishingFilesManager.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -225,6 +225,7 @@
59F0D250131F8A2400E3F979 /* Nitrogen.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nitrogen.framework; path = "../../osirix-trunk/nitrogen/build/Development/Nitrogen.framework"; sourceTree = SOURCE_ROOT; };
59FCD7AD11905E56007B28E0 /* DiscPublishingToolAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DiscPublishingToolAppDelegate.h; path = Classes/DiscPublishingToolAppDelegate.h; sourceTree = "<group>"; };
59FCD7B011905E78007B28E0 /* DiscPublishingToolAppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DiscPublishingToolAppDelegate.mm; path = Classes/DiscPublishingToolAppDelegate.mm; sourceTree = "<group>"; };
71327A8A14683DBD007E49BE /* Versions.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Versions.txt; sourceTree = "<group>"; };
AB5D36050680E57E00F4007A /* DiscPublishing.osirixplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DiscPublishing.osirixplugin; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -269,6 +270,7 @@
isa = PBXGroup;
children = (
596D309C143999E7004EE9EC /* TODO.txt */,
71327A8A14683DBD007E49BE /* Versions.txt */,
59B3FC05117C38330027B0DB /* Weird.txt */,
59FCD7821190492B007B28E0 /* Common */,
59BDFBB31185B897007F1F2C /* Plugin */,
Expand Down Expand Up @@ -842,12 +844,9 @@
GCC_PREFIX_HEADER = Prefix.pch;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = NO;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Resources/Info.plist;
INSTALL_PATH = "@executable_path/../Plug-ins";
LIBRARY_SEARCH_PATHS = "";
LIBRARY_STYLE = Bundle;
MACOSX_DEPLOYMENT_TARGET = 10.5;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
Expand All @@ -874,9 +873,9 @@
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/System/Library/Frameworks/Carbon.framework/Frameworks",
"\"$(SRCROOT)/Libs\"",
"\"$(SRCROOT)/../../osirix-branch-coredata/build/Development\"",
"\"$(SRCROOT)/../../osirix-trunk/build/Development\"",
);
MACOSX_DEPLOYMENT_TARGET = 10.5;
MACOSX_DEPLOYMENT_TARGET = 10.6;
SDKROOT = macosx10.6;
VALID_ARCHS = "i386 x86_64";
};
Expand Down
6 changes: 1 addition & 5 deletions DiscPublishing/TODO.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
Known bugs:
- It seem that the index.html is not generated correctly by the DiscPublishing plugin (it's ok using the burn feature of OsiriX).
All links to the jpeg/quicktime files are broken and directed to a folder named "tmp" in the webpage's source code.

Next:
- Customizable merge values with custom DICOM meta data

Important-ish
! treat series that don't fit on a single disc
- at start recover jobs from jobs dir
- at start recover jobs from jobs dir (we currently delete them)
- dialog for 'Publish' button

Later...
Expand Down
4 changes: 4 additions & 0 deletions DiscPublishing/Versions.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.1.1
- Fixed disc cover merge text encoding bug
- No longer relying on dcmmkdir for DICOMDIR generation, depending on the version of OsiriX

1.1
- Upgrade to Primera SDK 2.2, which includes support for DP 4100 Series
- DICOMDIR is now generated in a cleaner way: a lot of warnings will no longer be output from dcmmkdir
Expand Down
Binary file modified DiscPublishing/html/DiscPublishing.osirixplugin.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion DiscPublishing/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</head>
<body>
<div id="plugin_icon"><img src="Plugin.jpg" border="0" /></div>
<h1>DiscPublishing 1.1</h1>
<h1>DiscPublishing 1.1.1</h1>
<div id="text">
This plugin allows you to use a Primera DiscPublisher robot with OsiriX.<br/>
<br/>
Expand Down

0 comments on commit 9fdf866

Please sign in to comment.