Compiling dcmtk for iOS

Created by Alin Brindusescu on 2012-06-04 11:50:15

The best open source option, on my opinion, for handling dicom files is the Dcmtk library.
Here are the steps i have followed in order to compile dctmk for iOS:

  • get the sources from the dcmtk repository:
     
    # git clone http://github.com/commontk/DCMTK DCMTK 
     
    I had some problems to compile the dcmtk-3.6.0 release sources but everything went fine with the development sources. Since most of the time I could not reproduce the results of a tutorial most of the time because I could not find the exact packages here are the sources I have used.
  • Configure the project using cmake
  • Build for testing for mac
  • Go to project Build Settings and change the base SDK to Latest iOS
  • In the build settings change also the architecture to Standard armv7
  • In the Xcode find the osconfig.h file and comment the
    #define HAVE_LIBC_H 1
    line
Pay attention to the files you want to include the dcmtk headers, the simplest way to stay away from troubles is to change the extension of the files from .m to .mm

See more in ENG

How to get the version and build details

Created by Alin Brindusescu on 2011-12-12 15:22:40

If you use to develop for iOS with Xcode you noticed that in the project settings page you have a version and build number. I was wondering how could I get them in my code to format a string for the about message. Here is how I manage to get this:

 
    NSDictionary *projectInfo = [[NSBundle mainBundle] infoDictionary];
    NSString *appName = [projectInfo objectForKey:@"CFBundleDisplayName"];
    NSString *appVersion = [projectInfo objectForKey:@"CFBundleShortVersionString"];
    NSString *appBuild = [projectInfo objectForKey:@"CFBundleVersion"];
    NSString *appVersionStr = [NSString stringWithFormat:@"%@ V%@ R%@", appName, appVersion, appBuild];
 
See more in ENG ROM

Background mode issues with pjsip for iOS and freeSwitch

Created by Alin Brindusescu on 2011-12-08 08:06:05
Last week I had some problems keeping the connection open between my iPhone app and the freeSwitch sip server.

After a lot of changes I figured out that I have to add to the configuration of the freeSwitch user/extension ($FREESWITCH_INSTAL_FOLDER/conf/directory/default/user.xml) this line:

 
<variable name="sip-force-contact" value="NDLB-connectile-dysfunction"/>
 


All of this are needed because freeSwitch should contact the iOS app on the same TCP port he got the registration request.
See more in ENG ROM

Ksh file name substitution

Created by Alin Brindusescu on 2011-02-23 04:22:55
? match any single character
* match zero or more characters, including null
[abc] match any character or characters between the brackets
[x-z] match any character or characters in the range x to z
[a-ce-g] match any character or characters in the range a to c, e to g
[!abc] match any character or characters not between the brackets
[!x-z] match any character or characters not in the range x to z
. strings starting with . must be explicitly matched
?(pattern-list) match zero or one occurrence of any pattern
*(pattern-list) match zero or more occurrences of any pattern
+(pattern-list) match one or more occurrence of any pattern
@(pattern-list) match exactly one occurrence of any pattern
!(pattern-list) match anything except any pattern
| multiple patterns must be separated with a | character


See more in ENG

Executing a sequence of commands in unix shell

Created by Alin Brindusescu on 2011-02-21 03:36:59

Last week I was arguing with a work colleague about how a sequence of commands is executed. And since I haven't upgrade my memory to a 64 bits system I had a look on the internet to see if I'm right or not and then update this here as an extension to my memory.

So what is the difference between:

 
# ./configure; make; make install
 
and 
 
# ./configure && make && make install
 
and when we have to use the first or the second one.

When using ; the commands are executed one after each other without taking into account the result of the run of the previous one. So if the execution of configure fail make and make install will still be executed. So, use ; into a sequence of commands if you want all commands to be executed. For our case this dosen't make to much sense, because if configure fails then we have no reason to run make.
When using && the commands are executed one after each other but if one of the commands fail then the next on the sequence will not be executed anymore. So if the execution of configure fail then make and make install will not be executed. So, use && into a sequence of commands if there is some logical flow to be considered. For our case this make sense, because if configure fails then we have no reason to run make, or if make fails then we have no reason to run make install even if the configure ended with success.

There is one more operand ||, using this operand will cause the execution of the right side command only if the first command fails. For example

 
# ./configure || echo "Configure Fail"
 
here the echo command is executed only if the return status of configure is non zero.

All this 3 can be combined in one line but some rules should be considered otherwise the results would be unexpected.
In the following example:

 
# ./configure || echo "Configure Fail" ; cat error_log
 
the cat command is executed even if the configure command it dose not fail.
Now let's try to add the cat to our configure make sequence:
 
# ./configure && make && make install || cat error_log
 
In this sequence if configure fails then cat is executed, if configure is successful and make fails cat will still be executed and so on. If all the commands return 0 then cat will not be executed. I found this sequence very useful
The commands and the logical operators can be grouped to form more complex execution flows using {} or ().
When using {} to group the commands the commands will be executed in the current shell and when grouping with () the commands will be executed in a subshell.



See more in ENG ROM

Search

Ads