docstr: Test that an input image returns an expected normalized image.
  
  For test case 2:
  - This case tests calling the stain normalizer, after the
    _deconvolution_extract_conc function. This is because the normalized
    concentration returned for each pixel is the same as the reference
    maximum stain concentrations in the case that the image is uniformly
    filled, as in this test case. This is because the maximum concentration
    for each stain is the same as each pixel's concentration.
  - Thus, the normalized concentration matrix should be a (2, 6) matrix
    with the first row having all values of 1.9705, second row all 1.0308.
  - Taking the matrix product of the target stain matrix and the concentration
    matrix, then using the inverse Beer-Lambert transform to obtain the RGB
    image from the absorbance image, and finally converting to uint8,
    we get that the stain normalized image should be a matrix of
    dims (3, 2, 3), with all values 11.
  
  For test case 3:
  - This case also tests calling the stain normalizer, after the
    _deconvolution_extract_conc function returns the image concentration
    matrix.
  - As in test case 2, the normalized concentration matrix should be a (2, 6) matrix
    with the first row having all values of 1.9705, second row all 1.0308.
  - Taking the matrix product of the target default stain matrix and the concentration
    matrix, then using the inverse Beer-Lambert transform to obtain the RGB
    image from the absorbance image, and finally converting to uint8,
    we get that the stain normalized image should be [[[63, 25, 60], [63, 25, 60]],
    [[63, 25, 60], [63, 25, 60]], [[63, 25, 60], [63, 25, 60]]]
  
  For test case 4:
  - For this non-uniformly filled image, the stain extracted should be
    [[0.70710677,0.18696113],[0,0],[0.70710677,0.98236734]], as validated for the
    ExtractHEStains class. Solving the linear least squares problem (since
    absorbance matrix = stain matrix * concentration matrix), we obtain the concentration
    matrix that should be [[-0.3101, 7.7508, 7.7508, 7.7508, 7.7508, 7.7508],
    [5.8022, 0, 0, 0, 0, 0]]
  - Normalizing the concentration matrix, taking the matrix product of the
    target stain matrix and the concentration matrix, using the inverse
    Beer-Lambert transform to obtain the RGB image from the absorbance
    image, and finally converting to uint8, we get that the stain normalized
    image should be [[[87, 87, 87], [33, 33, 33]], [[33, 33, 33], [33, 33, 33]],
    [[33, 33, 33], [33, 33, 33]]]
docstr_tok: ["Test","that","an","input","image","returns","an","expected","normalized","image",".","For","test","case","2",":","-","This","case","tests","calling","the","stain","normalizer",",","after","the","_deconvolution_extract_conc","function",".","This","is","because","the","normalized","concentration","returned","for","each","pixel","is","the","same","as","the","reference","maximum","stain","concentrations","in","the","case","that","the","image","is","uniformly","filled",",","as","in","this","test","case",".","This","is","because","the","maximum","concentration","for","each","stain","is","the","same","as","each","pixel","'s","concentration",".","-","Thus",",","the","normalized","concentration","matrix","should","be","a","(","2",",","6",")","matrix","with","the","first","row","having","all","values","of","1.9705",",","second","row","all","1.0308",".","-","Taking","the","matrix","product","of","the","target","stain","matrix","and","the","concentration","matrix",",","then","using","the","inverse","Beer-Lambert","transform","to","obtain","the","RGB","image","from","the","absorbance","image",",","and","finally","converting","to","uint8",",","we","get","that","the","stain","normalized","image","should","be","a","matrix","of","dims","(","3",",","2",",","3",")",",","with","all","values","11",".","For","test","case","3",":","-","This","case","also","tests","calling","the","stain","normalizer",",","after","the","_deconvolution_extract_conc","function","returns","the","image","concentration","matrix",".","-","As","in","test","case","2",",","the","normalized","concentration","matrix","should","be","a","(","2",",","6",")","matrix","with","the","first","row","having","all","values","of","1.9705",",","second","row","all","1.0308",".","-","Taking","the","matrix","product","of","the","target","default","stain","matrix","and","the","concentration","matrix",",","then","using","the","inverse","Beer-Lambert","transform","to","obtain","the","RGB","image","from","the","absorbance","image",",","and","finally","converting","to","uint8",",","we","get","that","the","stain","normalized","image","should","be","[","[","[","63",",","25",",","60","]",",","[","63",",","25",",","60","]","]",",","[","[","63",",","25",",","60","]",",","[","63",",","25",",","60","]","]",",","[","[","63",",","25",",","60","]",",","[","63",",","25",",","60","]","]","]","For","test","case","4",":","-","For","this","non-uniformly","filled","image",",","the","stain","extracted","should","be","[","[","0.70710677,0.18696113","]",",","[","0,0","]",",","[","0.70710677,0.98236734","]","]",",","as","validated","for","the","ExtractHEStains","class",".","Solving","the","linear","least","squares","problem","(","since","absorbance","matrix","=","stain","matrix","*","concentration","matrix",")",",","we","obtain","the","concentration","matrix","that","should","be","[","[","-0.3101",",","7.7508",",","7.7508",",","7.7508",",","7.7508",",","7.7508","]",",","[","5.8022",",","0",",","0",",","0",",","0",",","0","]","]","-","Normalizing","the","concentration","matrix",",","taking","the","matrix","product","of","the","target","stain","matrix","and","the","concentration","matrix",",","using","the","inverse","Beer-Lambert","transform","to","obtain","the","RGB","image","from","the","absorbance","image",",","and","finally","converting","to","uint8",",","we","get","that","the","stain","normalized","image","should","be","[","[","[","87",",","87",",","87","]",",","[","33",",","33",",","33","]","]",",","[","[","33",",","33",",","33","]",",","[","33",",","33",",","33","]","]",",","[","[","33",",","33",",","33","]",",","[","33",",","33",",","33","]","]","]"]
code: def test_result_value(self, arguments, image, expected_data):
      """
      Test that an input image returns an expected normalized image.
  
      For test case 2:
      - This case tests calling the stain normalizer, after the
        _deconvolution_extract_conc function. This is because the normalized
        concentration returned for each pixel is the same as the reference
        maximum stain concentrations in the case that the image is uniformly
        filled, as in this test case. This is because the maximum concentration
        for each stain is the same as each pixel's concentration.
      - Thus, the normalized concentration matrix should be a (2, 6) matrix
        with the first row having all values of 1.9705, second row all 1.0308.
      - Taking the matrix product of the target stain matrix and the concentration
        matrix, then using the inverse Beer-Lambert transform to obtain the RGB
        image from the absorbance image, and finally converting to uint8,
        we get that the stain normalized image should be a matrix of
        dims (3, 2, 3), with all values 11.
  
      For test case 3:
      - This case also tests calling the stain normalizer, after the
        _deconvolution_extract_conc function returns the image concentration
        matrix.
      - As in test case 2, the normalized concentration matrix should be a (2, 6) matrix
        with the first row having all values of 1.9705, second row all 1.0308.
      - Taking the matrix product of the target default stain matrix and the concentration
        matrix, then using the inverse Beer-Lambert transform to obtain the RGB
        image from the absorbance image, and finally converting to uint8,
        we get that the stain normalized image should be [[[63, 25, 60], [63, 25, 60]],
        [[63, 25, 60], [63, 25, 60]], [[63, 25, 60], [63, 25, 60]]]
  
      For test case 4:
      - For this non-uniformly filled image, the stain extracted should be
        [[0.70710677,0.18696113],[0,0],[0.70710677,0.98236734]], as validated for the
        ExtractHEStains class. Solving the linear least squares problem (since
        absorbance matrix = stain matrix * concentration matrix), we obtain the concentration
        matrix that should be [[-0.3101, 7.7508, 7.7508, 7.7508, 7.7508, 7.7508],
        [5.8022, 0, 0, 0, 0, 0]]
      - Normalizing the concentration matrix, taking the matrix product of the
        target stain matrix and the concentration matrix, using the inverse
        Beer-Lambert transform to obtain the RGB image from the absorbance
        image, and finally converting to uint8, we get that the stain normalized
        image should be [[[87, 87, 87], [33, 33, 33]], [[33, 33, 33], [33, 33, 33]],
        [[33, 33, 33], [33, 33, 33]]]
      """
      key = "image"
      if image is None:
          with self.assertRaises(TypeError):
              NormalizeHEStainsD([key])({key: image})
      else:
          result = NormalizeHEStainsD([key], **arguments)({key: image})
          np.testing.assert_allclose(result[key], expected_data)
  
file_path: MONAI/tests/test_pathology_he_stain_dict.py
imports: from __future__ import annotations
  import unittest
  import numpy
  from parameterized import parameterized
  from monai.apps.pathology.transforms import ExtractHEStainsD, NormalizeHEStainsD
label_desc: Use image node_id 2 for calling the TestNormalizeHEStainsD obj's underlying member method code with example usage: obj.test_result_value(arguments, image, expected_data) without return types