Applications for residence permits for medical treatment must be submitted to the embassy in your home country (see above).
If you are already in Norway and your medical condition is acute, it may be possible for you to submit the application in Norway instead. Please ask the UDI about this possibility before submitting your application.