REST API of pixels-masker
=========================

NB: The identifiers below correspond to BRAINIX.


REST API proposal:

{
	"MaskPixelData" : {
		"Regions": [
			{
				"MaskType": "MeanFilter",
				"FilterWidth": 20,
				"RegionType" : "2D",             // area is defined by an area in pixel coordinates
				"Origin": [150, 100],            // X, Y in pixel coordinates
				"End": [400, 200],               // X, Y in pixel coordinates
				"TargetSeries" : [               // the series the pixel mask applies to.  If empty -> applies to all series
					"cd589a09-6e705e06-57997219-7812eb49-709873a9"
				],
        "TargetInstances" : [            // the instances the pixel mask applies to.  If empty -> applies to all instances
        ]
			},
			{
				"MaskType": "Fill",
				"FillValue": 0,
				"RegionType" : "3D",                // area is defined by a volume in world coordinates
				"Origin": [-150.5, -250.4, -811],   // X, Y, Z in World coordinates
				"End": [148.4, 220.7, -955],        // X, Y, Z in World coordinates
				"TargetSeries" : [                  // in this mode, no need to list the instances since the Z coordinate shall handle that !
					"94df9100-3b476f5b-f4e8c381-d78c327f-a387bc7e"
				]
			}
		]
	}
}

# anonymize a single instance
curl http://localhost:8042/plugins/pixels-masker/instances/19565ed8-6bd8f20e-efbd6c34-36688133-bc91329e/anonymize --data-binary '{"MaskPixelData" : {"Regions": [{"MaskType": "MeanFilter", "FilterWidth": 20, "RegionType" : "Pixels", "Origin": [150, 100], "End": [400, 200]} ]} }' --output out.dcm
curl http://localhost:8042/plugins/pixels-masker/instances/19565ed8-6bd8f20e-efbd6c34-36688133-bc91329e/anonymize --data-binary '{"MaskPixelData" : {"Regions": [{"MaskType": "Fill", "FillValue": 0, "RegionType" : "Pixels", "Origin": [150, 100], "End": [400, 200]} ]} }' --output out.dcm

# modify all slices of one series of a study
curl -X POST http://localhost:8043/plugins/pixels-masker/studies/27f7126f-4f66fb14-03f4081b-f9341db2-53925988/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.3", "StudyDescription": "modified-all-slices2"},
    "Force": true,
    "Asynchronous": true,
    "KeepLabels": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "Fill",
            "FillValue": 4000,
            "RegionType" : "2D",
            "Origin": [150, 100],
            "End": [400, 200],
            "TargetSeries" : ["d5f6c1a2-d6f2f01a-a3cc4e8b-424476dc-f34b0cd1"]
      }]
    }
}
EOF


# modify a few slices of one series of a study
curl -X POST http://localhost:8042/plugins/pixels-masker/studies/27f7126f-4f66fb14-03f4081b-f9341db2-53925988/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.3", "StudyDescription": "modified-few-slices"},
    "Force": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "Fill",
            "FillValue": 4000,
            "RegionType" : "2D",
            "Origin": [150, 100],
            "End": [400, 200],
            "TargetInstances" : ["11e0b13a-fb44c3d5-819193d8-314b3bb5-4da13bc4", "372d70bb-886e6cc5-a89eefcc-405b2346-f4676bb2"]
      }]
    }
}
EOF

# modify a few slices of one series of a study with a 3D Region
curl -X POST http://localhost:8042/plugins/pixels-masker/studies/27f7126f-4f66fb14-03f4081b-f9341db2-53925988/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.3", "StudyDescription": "modified-few-slices"},
    "Force": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "Fill",
            "FillValue": 4000,
            "RegionType" : "3D",
            "Origin": [-150.0, -300, -750],
            "End": [150.0, -250, -1000]
      }]
    }
}
EOF

curl -X POST http://localhost:8042/plugins/pixels-masker/studies/27f7126f-4f66fb14-03f4081b-f9341db2-53925988/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.3", "StudyDescription": "modified-few-slices"},
    "Force": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "MeanFilter",
            "FilterWidth": 30,
            "RegionType" : "3D",
            "Origin": [-150.0, -300, -750],
            "End": [150.0, -250, -1000]
      }]
    }
}
EOF


# modify all frames of a multiframe study (CARDIO)
curl -X POST http://localhost:8042/plugins/pixels-masker/studies/595df1a1-74fe920a-4b9e3509-826f17a3-762a2dc3/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.4", "StudyDescription": "modified-multi-frame"},
    "Force": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "MeanFilter",
            "FilterWidth": 30,
            "RegionType" : "2D",
            "Origin": [150, 100],
            "End": [400, 200]
      }]
    }
}
EOF

# modify all frames of a multiframe US study (Cine US, TS = .50)
curl -X POST http://localhost:8042/plugins/pixels-masker/studies/50f2961c-c35755eb-8762b05b-0e01cd97-dd8a294c/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.5", "StudyDescription": "modified-multi-frame-us"},
    "Force": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "MeanFilter",
            "FilterWidth": 30,
            "RegionType" : "2D",
            "Origin": [0, 0],
            "End": [768, 45]
      }]
    }
}
EOF


# modify some frames of a multiframe scintigraphy study
curl -X POST http://localhost:8042/plugins/pixels-masker/studies/ab67d5f8-95865506-8fb83c8b-93610651-ddce6e77/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.6", "StudyDescription": "modified-scinti"},
    "Force": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "Fill",
            "FillValue": 3000,
            "RegionType" : "3D",
            "Origin": [-150.0, -200, 200],
            "End": [150.0, -150, 100]
      }]
    }
}
EOF

# modify some frames of a multiframe scintigraphy series
curl -X POST http://localhost:8042/plugins/pixels-masker/series/4baa97c7-d53d3d82-a5eb9403-17ef5a77-4e0efb55/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.6", "StudyDescription": "modified-scinti"},
    "Force": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "Fill",
            "FillValue": 3000,
            "RegionType" : "3D",
            "Origin": [-150.0, -200, 200],
            "End": [150.0, -150, 100]
      }]
    }
}
EOF



# modify some frames of a multiframe PET-CT study
curl -X POST http://localhost:8042/plugins/pixels-masker/studies/890e1167-55ad171a-7721ffec-db91e2c1-700778c0/modify \
--data-binary @- << EOF
{
    "Replace" : {"StudyInstanceUID": "1.2.7", "StudyDescription": "modified-pet-ct"},
    "Force": true,
    "MaskPixelData": {
        "Regions": [{
            "MaskType": "Fill",
            "FillValue": 3000,
            "RegionType" : "3D",
            "Origin": [-150.0, -100, -85],
            "End": [150.0, 100, -250]
      }]
    }
}
EOF
