Search code examples
iosios8ios9healthkitresearchkit

Capture an image of a skin rash in ResearchKit


I am working on Apple ResearchKit application for Lupus patients. I have already put some surveys and a task for walking activity.

Now I need capture image of a skin rash at frequent intervals, save it inside the app only (not in photos app) and compare the newest image with the last image taken.

I need to know if I can use ResearchKit to do the above said task. How can I open the iPhone camera and capture an image using ResearchKit? I know image comparison is a task outside ResearchKit. But my first priority is capturing the image in ResearchKit. Is it possible to use ResearchKit or do I have to do this task outside the scope of RK. Please provide me with any code or any link if available.

Thanks in advance


Solution

  • @prateek ResearchKit has a Image Capture step which can do what you require. You'll also have to declare an output directory for the captured image in your task view controller. Sample code below.

    ORKImageCaptureStep *imageCaptureStep = [[ORKImageCaptureStep alloc] initWithIdentifier:@"ImageCaptureStep"];
    imageCaptureStep.title = /*Title for the step*/;
    
    ORKTaskViewController *taskViewController = [[ORKTaskViewController alloc] initWithTask:imageCaptureStep taskRunUUID:nil];
    taskViewController.delegate = self;
    taskViewController.outputDirectory = /*where to store your image*/;
    

    And don't forget to implement the "ORKTaskViewControllerDelegate" for the task view controller.